private void destroyEverything() { // Unregister delegates properly GetTextureByOnRenderImage getTextureComponent = gameObject.GetComponent <GetTextureByOnRenderImage>(); if (getTextureComponent != null) { getTextureComponent.UnregisterDelegates(); } if (!EditorApplication.isPlayingOrWillChangePlaymode) { ComponentManager.DestroyManagedComponent <GetTextureByOnRenderImage>(gameObject, null); } NativePluginBridge.SYPHON.ShutdownGLCoreServer(); serverCreated = false; // Release the camera. var componentCamera = GetComponent <Camera>(); componentCamera.targetTexture = null; componentCamera.ResetAspect(); // Release temporary assets. if (_gammaMaterial) { DestroyImmediate(_gammaMaterial); } _gammaMaterial = null; }
private void destroyEverything() { // Unregister delegates properly GetTextureByOnRenderImage getTextureComponent = gameObject.GetComponent <GetTextureByOnRenderImage>(); if (getTextureComponent != null) { getTextureComponent.UnregisterDelegates(); } // Don't bother to destroy managed components in case of game starting if (EditorApplication.isPlayingOrWillChangePlaymode) { ComponentManager.DestroyManagedComponent <GetTextureByOnRenderImage>(gameObject, null); } GraphicEventManager.IssuePluginEvent((int)SyphonGraphicEvent.StopServer, System.IntPtr.Zero); if (metalServerTexture != null) { if (Application.isPlaying) { DestroyImmediate(metalServerTexture); } else { DestroyImmediate(metalServerTexture); } } metalServerTexture = null; // Dispose the internal objects. if (metalBlitMaterial != null) { if (Application.isPlaying) { DestroyImmediate(metalBlitMaterial); } else { DestroyImmediate(metalBlitMaterial); } } }
private void DestroyEverything() { if (spoutSender != System.IntPtr.Zero) { GraphicEventManager.IssuePluginEvent((int)SpoutGraphicEvent.Dispose, spoutSender); spoutSender = System.IntPtr.Zero; } // Unregister delegates properly GetTextureByOnRenderImage getTextureComponent = gameObject.GetComponent <GetTextureByOnRenderImage>(); if (getTextureComponent != null) { getTextureComponent.UnregisterDelegates(); } // Don't bother to destroy managed components in case of game starting if (!EditorApplication.isPlayingOrWillChangePlaymode) { ComponentManager.DestroyManagedComponent <GetTextureByOnRenderImage>(gameObject, null); } Utils.DestroyUnityObject(blitMaterial); Utils.DestroyUnityObject(sharedTexture); }