Skip to content

Commit b3ce15a

Browse files
committed
Merge pull request #10209 from wonkee-kim/fix/construct-gltf-standard-shader-material-color
Fix gltf object appears black
1 parent e220b93 commit b3ce15a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Assets/MRTK/Core/Utilities/Gltf/Serialization/ConstructGltf.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,10 @@ private static async Task<Material> CreateStandardShaderMaterial(GltfObject gltf
360360
material.mainTexture = gltfObject.images[gltfMaterial.pbrMetallicRoughness.baseColorTexture.index].Texture;
361361
}
362362

363-
material.color = gltfMaterial.pbrMetallicRoughness.baseColorFactor.GetColorValue();
363+
if (gltfMaterial.pbrMetallicRoughness?.baseColorFactor != null)
364+
{
365+
material.color = gltfMaterial.pbrMetallicRoughness.baseColorFactor.GetColorValue();
366+
}
364367

365368
if (gltfMaterial.alphaMode == "MASK")
366369
{

0 commit comments

Comments
 (0)