CameraImageRenderer Class¶
Description¶
MonoBehaviour which controls camera image rendering in the scene. Unity universal render pipeline (URP) is not supported yet, you can extend this class for URP support.
MonoBehaviour Messages¶
protected virtual void Awake() |
protected virtual void OnEnable() |
protected virtual void OnDisable() |
protected virtual void OnDestroy() |
Events¶
OnFrameRenderUpdate¶
Camera image rendering update event. This event will pass out the Material and texture size of current camera image rendering. This event only indicates a new render happens, while the camera image itself may not change.
Methods¶
RequestTargetTexture¶
- C#
public void RequestTargetTexture(Action< Camera , RenderTexture > targetTextureEventHandler)
Get the RenderTexture of camera image.
The texture is a full sized image from OutputFrame , not cropped by the screen. The action targetTextureEventHandler will pass out the RenderTexture and the Camera drawing the texture when the texture created or changed, will not call every frame or when the camera image data change. Calling this method will create external resources, and will trigger render when necessary, so make sure to release the resource using CameraImageRenderer.DropTargetTexture when not use.
DropTargetTexture¶
- C#
public void DropTargetTexture(Action< Camera , RenderTexture > targetTextureEventHandler)
Release the RenderTexture of camera image. Internal resources will be released when all holders release.