private void OnDestroy() { SaveChunkData(); PathFinding.Dispose(); WorldSettings.Dispose(); // dispose native containers pendingJobs.Dispose(); meshBakingJobs.Dispose(); }
public void DisposeAndSave() { SaveChunkData(); // dispose all active & pooled chunks foreach (var chunk in Chunks.Values) { chunk.Dispose(); } foreach (var chunk in pooledChunks) { chunk.Dispose(); } PathFinding.Dispose(); WorldSettings.Dispose(); // dispose native containers chunkBuildingJobs.Dispose(); meshBakingJobs.Dispose(); }