// Display the rendered texture to UI <root> <Image Texture=@RenderTexture style="width: 128; height: 128" /> </root> @code { public CameraComponent Camera { get; set; } Texture RenderTexture { get; set; } public override void Tick() { if ( Camera is null ) return; // Take a screenshot of size 128x128 (static method) RenderTexture = BasicScreenshot.TakeScreenshot(Camera, 128, 128); } }
static public Texture TakeScreenshot(CameraComponent cameraComponent, Vector2 size, ImageFormat format = ImageFormat.RGBA8888, bool log = false)
static public Texture TakeScreenshot(CameraComponent cameraComponent, int width, int height, ImageFormat format = ImageFormat.RGBA8888, bool log = false)
static public Texture TakeScreenshot(GameObject camera, int width, int height, ImageFormat format = ImageFormat.RGBA8888, bool log = false)
static public Texture TakeScreenshot(GameObject camera, Vector2 size, ImageFormat format = ImageFormat.RGBA8888, bool log = false)
static public void TakeScreenshotAndSaveAsPng(CameraComponent cameraComponent, string path, Vector2 size, ImageFormat format = ImageFormat.RGBA8888, int mip = 0, bool log = true)
static public void TakeScreenshotAndSaveAsJpeg(CameraComponent cameraComponent, string path, Vector2 size, ImageFormat format = ImageFormat.RGBA8888, int mip = 0, bool log = true)
static public void TextureToJpeg(Texture texture, string path, int mip = 0, bool log = true)
static public void TextureToPng(Texture texture, string path, int mip = 0, bool log = true)