/// <summary> /// Shutsdown the server thread and clears all data. /// </summary> internal void Shutdown() { m_ServerThread.Stop(); foreach (var chunk in m_Chunks) { m_ChunkCreator.DestroyChunk(chunk); } m_Chunks.Clear(); }
/// <summary> /// Called when the BlockWorld behaviour is disabled. /// </summary> private void OnDisable() { if (m_WorldContainer == null) { return; // Already disabled } m_WorldContainer.BlockContainerProvider.OnBlockContainerCreated -= OnChunkCreated; m_WorldContainer.BlockContainerProvider.OnBlockContainerDestroyed -= OnChunkDestroyed; m_WorldContainer = null; foreach (var chunk in m_Chunks) { m_ChunkCreator.DestroyChunk(chunk); } m_Chunks.Clear(); #if UNITY_EDITOR if (!Application.isPlaying) { UnityEditor.EditorApplication.update -= Update; } #endif }