public void FreeResources() { FreeMaterials(); elementMaterials.Clear(); elementMaterials = null; if (worldChunks != null) { WorldChunk[,] array = worldChunks; int length = array.GetLength(0); int length2 = array.GetLength(1); for (int i = 0; i < length; i++) { for (int j = 0; j < length2; j++) { WorldChunk worldChunk = array[i, j]; worldChunk.FreeResources(); } } worldChunks = null; } }