void OnDestroy()
        {
            if (_receiver != System.IntPtr.Zero)
            {
                PluginEntry.DestroySharedObject(_receiver);
                _receiver = System.IntPtr.Zero;
            }

            if (_sharedTexture != null)
            {
                Destroy(_sharedTexture);
                _sharedTexture = null;
            }

            if (_fixedTexture != null)
            {
                Destroy(_fixedTexture);
                _fixedTexture = null;
            }
        }
Exemplo n.º 2
0
        void OnDisable()
        {
            if (_sender != System.IntPtr.Zero)
            {
                PluginEntry.DestroySharedObject(_sender);
                _sender = System.IntPtr.Zero;
            }

            if (_sharedTexture != null)
            {
                if (Application.isPlaying)
                {
                    Destroy(_sharedTexture);
                }
                else
                {
                    DestroyImmediate(_sharedTexture);
                }
                _sharedTexture = null;
            }
        }