I am currently creating a 3D graph. I am using a edge creator script that uses the LineRenderer class to create the edges. I need the edges to have multiple colors but I am having an issue when I build the project they show up as the default pink color. When I play the scene in the development environment, the game screen does show the correct color. I need for the edges to be in an Update() function because in the future a user will be able to change the locations of the vertices to change the layout of the graph. I have tried setting the color in Start() and where I am calling the function in Update() but the still come out pink when I build the project. I realize it is something with the Shader, but I am very unfamiliar with how shaders work. Here is an example of the code I am using. If someone could help and give me a brief explanation of how sharers work that would be great. I am using Unity 5.1.1 Personal.
LineRenderer edge;
void Start()
{
c2 = c1;
LineRenderer line = gameObject.AddComponent<LineRenderer>();
edge = line;
edge.material = new Material(Shader.Find("Particles/Additive"));
edge.SetColors(c1, c1);
}
//this is called in an Update()
public void createEdge(Vector3[] points)
{
index = 0;
edge.SetVertexCount(points.Length);
foreach (Vector3 edgeValues in points)
{
edge.SetWidth(edgeSize, edgeSize);
edge.SetColors(c1, c1);
edge.SetPosition(index, edgeValues);
index++;
}
}