- Home /
Question by
aguskos · Jan 16, 2017 at 05:39 PM ·
movementmesh verticesmesh color
Mesh.colors returns zero
I have this simple script. I tried to put it on simple mesh and cubes but mesh.colors is always zero. What am I missing here?
Mesh mesh = GetComponent<MeshFilter>().mesh;
Debug.Log(mesh.colors32.Length);
This is the shader i am using
Shader "Custom/Vertex Colored" {
Properties{
}
SubShader{
Pass{
ColorMaterial AmbientAndDiffuse
}
}
}
Comment
Best Answer
Answer by Bunny83 · Jan 16, 2017 at 06:20 PM
Well, if mesh.colors32
/ mesh.colors
return an empty array that means your mesh doesn't have any vertex colors.
As you can see as example the Unity default cube mesh doesn't have any vertex colors, only vertex positions (verts), and two sets of UV texture coordinates