using UnityEngine; namespace UnityEditor.Recorder { /// /// Base class for all Recorder inputs that capture images. /// public abstract class BaseRenderTextureInput : RecorderInput { /// /// Enables asynchronous readback of GPU resources if the platform supports it. /// Set this property to a valid instance and ensure that ReadbackTexture is not set. /// protected internal RenderTexture OutputRenderTexture { get; set; } /// /// Indicates the synchronous GPU readback destination. /// protected internal Texture2D ReadbackTexture { get; set; } /// /// Stores the output image width. /// public int OutputWidth { get; protected set; } /// /// Stores the output image height. /// public int OutputHeight { get; protected set; } /// /// Releases all resources allocated by this class instance. /// protected void ReleaseBuffer() { if (OutputRenderTexture != null) { if (OutputRenderTexture == RenderTexture.active) RenderTexture.active = null; OutputRenderTexture.Release(); OutputRenderTexture = null; } } /// /// Releases all resources allocated by this instance. /// /// If true, releases buffers allocated by this class as well. protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) ReleaseBuffer(); } } }