/// <summary> /// Creates a chunk with a given world position /// </summary> /// <param name="x">The latitude world position</param> /// <param name="y">The altitude world position</param> /// <param name="z">The longitude world position</param> public void CreateChunk(int x, int y, int z) { WorldPos worldPos = new WorldPos(x, y, z); // Instantiate the chunk at the using the chunk prefab GameObject newChunkObject = Instantiate(chunkPrefab, new Vector3(x, y, z), Quaternion.Euler(Vector3.zero)) as GameObject; Chunk newChunk = newChunkObject.GetComponent <Chunk>(); newChunk.pos = worldPos; newChunk.world = this; // Add it to the chunks dictionary with the world position as the key. chunks.Add(worldPos, newChunk); WorldGenerator worldGen = new WorldGenerator(); newChunk = worldGen.ChunkGen(newChunk); // Save stuff goes here later. }