void Destroy() { CancelInvoke(); //safe guard to make sure it only destroys once ChunkGenerator CG = GetComponent <ChunkGenerator>(); ChunkPos v = CG.actualChunkCoords; int x = (int)v.x / CG.GetChunkSize(); int z = (int)v.z / CG.GetChunkSize(); ChunkPos CP = new ChunkPos(x, z); GetComponentInParent <WorldGenerator>().chunkDictionary.Remove(CP); Destroy(gameObject); }