Exemple #1
0
 void OnDestroy()
 {
     if (SurfExtractor != null)
     {
         SurfExtractor.Reset();
     }
     if (_dataLoader != null)
     {
         _dataLoader.Close();
     }
     c_fWaterLvl = 97.0f;         // reset to default
     Debug.Log("Mem size before vfTerrain destroyed all chunks :" + GC.GetTotalMemory(true));
     // If something is left over... (in the editor)
     if (gameObject.transform.childCount > 0)
     {
         // Clean up chunks
         for (int i = gameObject.transform.childCount - 1; i >= 0; --i)
         {
             var child = gameObject.transform.GetChild(i).gameObject;
             DestroyImmediate(child);
         }
     }
     Resources.UnloadUnusedAssets();
     self = null;
     VFVoxelSave.Clean();
 }
Exemple #2
0
    void OnDestroy()
    {
        if (_lodDataUpdate != null)
        {
            _lodDataUpdate.Stop();
            _lodDataUpdate = null;
        }
        if (_transGoCreator != null)
        {
            _transGoCreator.IsTransvoxelEnabled = false;
            _transGoCreator = null;
        }
        if (SurfExtractor != null)
        {
            SurfExtractor.Reset();
        }
        if (_dataLoader != null)
        {
            _dataLoader.Close();
        }

        // If something is left over... (in the editor)
        if (gameObject.transform.childCount > 0)
        {
            // Clean up chunks
            for (int i = gameObject.transform.childCount - 1; i >= 0; --i)
            {
                var child = gameObject.transform.GetChild(i).gameObject;
                DestroyImmediate(child);
            }
        }
        Resources.UnloadUnusedAssets();
        TerrainVoxelComplete     = false;
        TerrainColliderComplete  = false;
        bChunkColliderRebuilding = true;
        self = null;
        VFVoxelSave.Clean();
    }