public GameObject CreateNewChunk(int x, int z, int loaderID) { //Create new terrain object, set name and parent to this. //Set position and then call function within Chunk Generator GameObject terrain = new GameObject(); terrain.name = "Chunk (" + x + ", " + z + ")"; terrain.transform.SetParent(transform); terrain.transform.position = new Vector3(x * chunkSize, 0, z * chunkSize); ChunkGenerator cg = terrain.AddComponent <ChunkGenerator>(); cg.DrawChunk(chunkSize, terrainOctaves, seed, new Vector2((chunkSize * x) + offset.x, (chunkSize * z) + offset.y), material, loaderID, heights, waterHeight, waterMaterial, waveOctaves, waveLevelOfDetail); return(terrain); }