private void LoadChunk(int posX, int posZ, int offsetX, int offsetZ) { if (!GetChunk(posX + offsetX, posZ + offsetZ)) { GameObject chunk = new GameObject("Chunk " + (posX + offsetX) + " " + (posZ + offsetZ)); chunk.transform.parent = gameObject.transform; WorldChunk renderChunk = chunk.AddComponent <WorldChunk>(); renderChunk.Generate(posX + offsetX, posZ + offsetZ); } }
public void GenerateSpawn(int size) { for (int x = -size; x < size; x++) { for (int z = -size; z < size; z++) { GameObject goChunk = new GameObject("Chunk " + x + " " + z); WorldChunk worldChunk = goChunk.AddComponent <WorldChunk>(); worldChunk.Generate(x, z); } } }