Chunk InitializeChunk(Int3 index, ChunkData data = null) { if (_chunks.ContainsKey(index)) { DeInitChunk(index); } var x = index.X; var y = index.Y; var z = index.Z; var chunk = data == null ? new Chunk(this, x, y, z, new Vector3(x * Chunk.CHUNK_SIZE_X, y * Chunk.CHUNK_SIZE_Y, z * Chunk.CHUNK_SIZE_Z), false) : new Chunk(this, data, false); var render = _renderPool.Get(); render.name = string.Format("Chunk {0} {1}", x, z); render.transform.position = Vector3.zero; render.Setup(chunk); chunk.Renderer = render; _chunks[index] = chunk; _library.Add(index); return(chunk); }