private void OnDestroy() { Destroy(slippageHeight); Destroy(slippageOutflow); water.OnDestroy(); lava.OnDestroy(); DoubleDataTexture.DestroyAll(); int numGrids = TOTAL_GRID_SIZE / GRID_SIZE + 1; for (int x = 0; x < numGrids; x++) { for (int y = 0; y < numGrids; y++) { int idx = x + y * numGrids; Destroy(gridLand[idx]); Destroy(gridWater[idx]); //Destroy(gridLava[idx]); } } }