public void Create_Chunk(int x, int y, int z) { WorldPos world_pos = new WorldPos(x, y, z); GameObject new_chunk_object = Instantiate(chunk_prefab, new Vector3(x, y, z), Quaternion.Euler(Vector3.zero)) as GameObject; Chunk new_chunk = new_chunk_object.GetComponent <Chunk>(); new_chunk.pos = world_pos; new_chunk.world = this; chunks.Add(world_pos, new_chunk); var terrain_gen = new TerrainGen(); new_chunk = terrain_gen.Chunk_Gen(new_chunk); }