void OnReceiveChunkData(NetworkMessage netMsg) { //Debug.Log("Recevied Chunk Data"); var msg = netMsg.ReadMessage <MessaageTypes.ChunkDataMessage>(); Chunk chunk = EditTerrain.GetChunk(msg.chunkPos); if (chunk == null) { Debug.Log("Chunk not loaded"); return; } foreach (MessaageTypes.MsgBlock msgBlock in msg.blocks) { Debug.Log(msg.chunkPos.x + "," + msg.chunkPos.y + "," + msg.chunkPos.z); Debug.Log(msgBlock.x + "," + msgBlock.y + "," + msgBlock.y); World.singleton.SetBlock(msgBlock.x + msg.chunkPos.x, msgBlock.y + msg.chunkPos.y, msgBlock.z + msg.chunkPos.z, BlockIDManager.GetBlock(msgBlock.blockID)); } //If chunk is already rendered update and rerender it. if (chunk.rendered) { chunk.update = true; } }