void OnDisable() { ImGuiUn.SetUnityContext(_context); ImGuiIOPtr io = ImGui.GetIO(); SetRenderer(null, io); SetPlatform(null, io); ImGuiUn.SetUnityContext(null); _context.textures.Shutdown(); _context.textures.DestroyFontAtlas(io); if (_usingURP) { if (_renderFeature != null) { _renderFeature.commandBuffer = null; } } else { if (_camera != null) { _camera.RemoveCommandBuffer(CameraEvent.AfterEverything, _cmd); } } if (_cmd != null) { RenderUtils.ReleaseCommandBuffer(_cmd); } _cmd = null; }
void OnDisable() { ImGuiUn.SetUnityContext(_context); ImGuiIOPtr io = ImGui.GetIO(); SetRenderer(null, io); SetPlatform(null, io); ImGuiUn.SetUnityContext(null); _context.textures.Shutdown(); _context.textures.DestroyFontAtlas(io); #if HAS_HDRP _usingHDRP = RenderUtils.IsUsingHDRP(); if (_usingHDRP) { // I know... I know... using a goto, but in this instance it makes things a lot cleaner // due to the preprocessor directives and how unity has grouped things. goto PostCommandBufferTeardown; } #endif if (_usingURP) { if (_renderFeature != null) { _renderFeature.commandBuffer = null; } } else { if (_camera != null) { _camera.RemoveCommandBuffer(CameraEvent.AfterEverything, _cmd); } } PostCommandBufferTeardown: if (_cmd != null) { RenderUtils.ReleaseCommandBuffer(_cmd); } _cmd = null; }