public void Uninitialize()
        {
            if (_dataSource == null)
            {
                return;
            }

            StopCoroutine("SequenceTrigger");

            //Releases sequence
            Bridge4DS.DestroySequence(_dataSource.FDVUUID);
            _dataSource = null;

            //Releases memory
            _newVerticesHandle.Free();
            _newUVsHandle.Free();
            _newTrianglesHandle.Free();
            _newTextureDataHandle.Free();
            if (_computeNormals)
            {
                _newNormalsHandle.Free();
            }

            if (!_preview)
            {
                for (int i = 0; i < _nbGeometryBuffers; i++)
                {
                    Destroy(_meshes[i]);
                }
                _meshes = null;
                for (int i = 0; i < _nbTextureBuffers; i++)
                {
                    Destroy(_textures[i]);
                }
                _textures = null;
            }

            _newVertices    = null;
            _newUVs         = null;
            _newTriangles   = null;
            _newNormals     = null;
            _newTextureData = null;

            _isSequenceTriggerON = false;
            _isInitialized       = false;

#if UNITY_EDITOR
#if UNITY_2017_3_OR_NEWER
            EditorApplication.playModeStateChanged -= HandleOnPlayModeChanged;
#else
            EditorApplication.playmodeStateChanged -= HandleOnPlayModeChanged;
#endif
#endif
        }
示例#2
0
        void Uninitialize()
        {
            if (!_isInitialized)
            {
                return;
            }

            //Releases sequence
            if (_dataSource != null)
            {
                Bridge4DS.DestroySequence(_dataSource.FDVUUID);
            }

            //Releases memory
            if (_newVerticesHandle.IsAllocated)
            {
                _newVerticesHandle.Free();
            }
            if (_newUVsHandle.IsAllocated)
            {
                _newUVsHandle.Free();
            }
            if (_newTrianglesHandle.IsAllocated)
            {
                _newTrianglesHandle.Free();
            }
            if (_newTextureDataHandle.IsAllocated)
            {
                _newTextureDataHandle.Free();
            }
            if (_newNormalsHandle.IsAllocated)
            {
                _newNormalsHandle.Free();
            }

            if (_meshes != null)
            {
                for (int i = 0; i < _meshes.Length; i++)
                {
                    DestroyImmediate(_meshes[i]);
                }
                _meshes = null;
            }
            if (_textures != null)
            {
                for (int i = 0; i < _textures.Length; i++)
                {
                    DestroyImmediate(_textures[i]);
                }
                _textures = null;
            }

            _dataSource     = null;
            _newVertices    = null;
            _newUVs         = null;
            _newTriangles   = null;
            _newNormals     = null;
            _newTextureData = null;

            _isSequenceTriggerON = false;
            _isInitialized       = false;

#if UNITY_EDITOR
            EditorApplication.pauseStateChanged -= HandlePauseState;
#endif
        }