Ejemplo n.º 1
0
        private void destroyEverything()
        {
            // Unregister delegates properly
            GetTextureByOnRenderImage getTextureComponent = gameObject.GetComponent <GetTextureByOnRenderImage>();

            if (getTextureComponent != null)
            {
                getTextureComponent.UnregisterDelegates();
            }

            if (!EditorApplication.isPlayingOrWillChangePlaymode)
            {
                MonoBehaviourManager.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;
        }
Ejemplo n.º 2
0
        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)
            {
                MonoBehaviourManager.DestroyManagedComponent <GetTextureByOnRenderImage>(gameObject, null);
            }

            GraphicEventManager.IssuePluginEvent((int)NativePluginBridge.SYPHON.GraphicEvent.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);
                }
            }
        }
Ejemplo n.º 3
0
        private void DestroyEverything()
        {
            if (spoutSender != System.IntPtr.Zero)
            {
                GraphicEventManager.IssuePluginEvent((int)NativePluginBridge.SPOUT.GraphicEvent.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)
            {
                MonoBehaviourManager.DestroyManagedComponent <GetTextureByOnRenderImage>(gameObject, null);
            }
            Utils.DestroyUnityObject(blitMaterial);
            Utils.DestroyUnityObject(sharedTexture);
        }