コード例 #1
0
    private static IEnumerator WaitThenFinishRefresh(Mesh[] meshes, MeshObject[] meshObjects, int newMeshObjectCount, Vector3Int dimensions, Material material)
    {
        yield return(null);

        for (int i = 0; i < newMeshObjectCount; i++)
        {
            MeshObject meshObject = meshObjects[i];
            if (meshObject == null)
            {
                continue;
            }

            Mesh mesh = meshes[i];
            if (mesh == null)
            {
                Destroy(meshObjects[i].gameObject);
                continue;
            }

            meshObject.transform.name          = "MeshObject #" + i;
            meshObject.transform.localPosition = VoxelGrid.IndexToCoords(i, dimensions) * Bin.WIDTH;
            meshObject.SetMesh(meshes[i]);
            meshObject.SetMaterial(material);
        }
    }