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(); } }
private void OnDisable() { foreach (KeyValuePair <CameraEvent, CommandBuffer> keyValuePair in this.m_CommandBuffers.Values) { this.m_Camera.RemoveCommandBuffer(keyValuePair.Key, keyValuePair.Value); keyValuePair.Value.Dispose(); } this.m_CommandBuffers.Clear(); if (this.profile != null) { this.DisableComponents(); } this.m_Components.Clear(); this.m_MaterialFactory.Dispose(); this.m_RenderTextureFactory.Dispose(); GraphicsUtils.Dispose(); }