public void OnChunkRemove(Terrain.TerrainChunkNode chunk, EventArgs e) { if (chunk.HasController(typeof(GrassPopulator))) { GrassPopulator grass = (GrassPopulator)chunk.GetController(typeof(GrassPopulator)); grass.Destroy(); grass = null; } if (chunk.HasController(typeof(RockPopulator))) { RockPopulator rock = (RockPopulator)chunk.GetController(typeof(RockPopulator)); rock.Destroy(); rock = null; } if (chunk.HasController(typeof(TreePopulator))) { TreePopulator tree = (TreePopulator)chunk.GetController(typeof(TreePopulator)); tree.Destroy(); tree = null; } }