- Home /
Mesh Colours transparent
Hey everyone,
I'm currently trying to colour the sides of my cube individually, and it's almost working by it seems to be transparent due to the shader. The shader is set to Particles -> Additive since that's the only one that seems to be taking colour edits by vertices... Here is what it looks like:
Here is my code in Start():
void Start ()
{
Mesh cubeMesh = GetComponent<MeshFilter>().mesh;
Color[] colours = new Color[cubeMesh.vertices.Length];
Debug.Log(cubeMesh.vertices.Length);
//side 1
colours[0] = Color.red;
colours[1] = Color.red;
colours[2] = Color.red;
colours[3] = Color.red;
//side 2
colours[4] = Color.green;
colours[5] = Color.green;
colours[6] = Color.green;
colours[7] = Color.green;
//side 3
colours[8] = Color.yellow;
colours[9] = Color.yellow;
colours[10] = Color.yellow;
colours[11] = Color.yellow;
//side 4
colours[12] = Color.magenta;
colours[13] = Color.magenta;
colours[14] = Color.magenta;
colours[15] = Color.magenta;
//side 5
colours[16] = Color.blue;
colours[17] = Color.blue;
colours[18] = Color.blue;
colours[19] = Color.blue;
//side 6
colours[20] = Color.black;
colours[21] = Color.black;
colours[22] = Color.black;
colours[23] = Color.black;
cubeMesh.colors = colours;
}
What am I doing wrong here? Thanks for the help!
cube-transparent.png
(26.9 kB)
Comment
Your answer
Follow this Question
Related Questions
Connecting flatshaded vertices 0 Answers
how to remove vertices of a certain colour range from a mesh? 0 Answers
Finding Viewport Coordinates of Vertices of Meshes that are in View 1 Answer
Modifying plane to fit view frustrum issue 0 Answers
How can I remove redundant vertices in custom mesh? 0 Answers