void OnDisable() { // Clear command buffers foreach (var cb in m_CommandBuffers.Values) { m_Camera.RemoveCommandBuffer(cb.Key, cb.Value); cb.Value.Dispose(); } m_CommandBuffers.Clear(); // Clear components if (profile != null) { DisableComponents(); } m_Components.Clear(); // Reset camera mode if (m_Camera != null) { m_Camera.depthTextureMode = DepthTextureMode.None; } // Factories m_MaterialFactory.Dispose(); m_RenderTextureFactory.Dispose(); GraphicsUtils.Dispose(); }
void OnDisable() { // Clear command buffers if (m_CommandBuffers != null) { foreach (var cb in m_CommandBuffers.Values) { m_Camera.RemoveCommandBuffer(cb.Key, cb.Value); cb.Value.Dispose(); } m_CommandBuffers.Clear(); } // Clear components if (profile != null) { DisableComponents(); } if (m_Components != null) { m_Components.Clear(); } // Factories if (m_MaterialFactory != null && m_RenderTextureFactory != null) { m_MaterialFactory.Dispose(); m_RenderTextureFactory.Dispose(); GraphicsUtils.Dispose(); } }