diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs index 9ae339707..2a6227ad4 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfData.cs @@ -330,9 +330,26 @@ namespace UniGLTF } } + // not black(0, 0, 0, 1) + static readonly UnityEngine.Color ZERO = new UnityEngine.Color(0, 0, 0, 0); + public bool HasVertexColor(glTFAttributes attributes) { - return attributes.COLOR_0 != -1; + if (attributes.COLOR_0 == -1) + { + return false; + } + + var colors = GetArrayFromAccessor(attributes.COLOR_0); + foreach (var color in colors) + { + if (color != ZERO) + { + return true; + } + } + // すべて (0, 0, 0, 0) だった。使っていないと見做す。 + return false; } public bool MaterialHasVertexColor(int materialIndex)