# Vertex not showing Mesh.Colors32 change.

I have the following code which if I have read everything correctly should make my drawn line black. However, it does not work! So without a doubt I have done something stupid. I am using the Unity standard Vertex shader. Here is the code I am using I would appreciate any guidance that would solve my problem:

``````void CreateMesh ()
{
//	Initialise the mesh

Mesh mesh = new Mesh();
MeshFilter mf = GetComponent<MeshFilter>();
mf.mesh = mesh;

//	Set up the variables

mQuadCount = 50 * mCycleDuration;			//	How may quads we draw ie 50 per second that the m cycle runs for
mTriangleCount = mQuadCount * 6;			//
mVerticesCount = mQuadCount * 4; 			//

//	Set up the arrays for the mesh

Vector3[] mVertices = new Vector3[mVerticesCount];
Vector3[] mNormals = new Vector3[mVerticesCount];
Vector2[] mUVs = new Vector2[mVerticesCount];
int[] mTriangles = new int[mTriangleCount];
Color32[] mColors = new Color32[mVerticesCount];

//	Assign the initial values to the arrays

float uvRatioX = 1 / mQuadCount;
//float uvRatioY = 0;

int index = 0;

for (int n = 0; n < mQuadCount; n++)
{
mVertices[index] = new Vector3(mPlotInterval * n, -mHeightOffset, 0.0f);				// 	Bottom Left
mUVs[index] = new Vector2(n * uvRatioX, 0.0f);
mColors[index] = new Color32(0, 0, 0, 0);
mVertices[index + 1] = new Vector3(mPlotInterval * n, mHeightOffset, 0.0f);				//	Top left
mUVs[index + 1] = new Vector2(n * uvRatioX, 1.0f);
mColors[index] = new Color32(0, 0, 0, 0);
mVertices[index + 2] = new Vector3(mPlotInterval * (n + 1),-mHeightOffset, 0.0f);		//	Bottom Right
mUVs[index + 2] = new Vector2((n + 1) * uvRatioX, 0.0f);
mColors[index] = new Color32(0, 0, 0, 0);
mVertices[index + 3] = new Vector3(mPlotInterval * (n + 1), mHeightOffset, 0.0f);		//	Top Right
mUVs[index + 3] = new Vector2((n + 1) * uvRatioX, 1.0f);
mColors[index] = new Color32(0, 0, 0, 0);
index += 4;
}

index = 0;

for (int n = 0; n < mQuadCount; n++)			//	0	1	2
{
mTriangles[index] = n * 4;					// 	0	4	8
mTriangles[index + 1] = (n * 4) + 1;		// 	1	5	9
mTriangles[index + 2] = (n * 4) + 2;		//	2	6	10

mTriangles[index + 3] = (n * 4) + 2;		//	2	6	10
mTriangles[index + 4] = (n * 4) + 1;		//	1	5	9
mTriangles[index + 5] = (n * 4) + 3;		//	3	7	11

index += 6;
}

//	Now we need to assign the arrays we have made to the mesh

mesh.vertices = mVertices;
mesh.normals = mNormals;
mesh.uv = mUVs;
mesh.triangles = mTriangles;
mesh.colors32 = mColors;
}
}
``````

When you are saying that you are using the “standard Unity Vertex Shader”, which one do you mean? For instance, VertexLit does not show vertex colors but the particle shaders do. Just to narrow it down, try this simple shader and see if you see any colors:

``````Shader "VertexColour"
{
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"

struct v2f {
float4 pos : SV_POSITION;
float3 color : COLOR0;
};

v2f vert (appdata_full v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.color = v.color;
return o;
}

half4 frag (v2f i) : COLOR
{
return half4 (i.color, 1);
}
ENDCG
}
}
Fallback "VertexLit"
}
``````