void Start() { meshFilter = GetComponent <MeshFilter>(); meshCollider = GetComponent <MeshCollider>(); voxelMeshBuilder = GameManager.Instance.GetVoxelMeshBuilder(); chunk = new Chunk(sizeX, sizeY, sizeZ); chunk.SetVoxel(0, 0, 0, Voxel.Type.Solid, Color.black); chunk.SetVoxel(1, 0, 0, Voxel.Type.Solid, Color.black); MeshData meshData = voxelMeshBuilder.BuildMesh(chunk); voxelMeshBuilder.RenderMesh(meshData, meshFilter, meshCollider); }
void InitGame() { voxelMeshBuilder = GameObject.Find("/Managers/VoxelMeshBuilder").GetComponent <VoxelMeshBuilder>(); colorTexture = GameObject.Find("/Managers/ColorTexture").GetComponent <ColorTexture>(); }