Answer the question
In order to leave comments, you need to log in
Why are the lines not displayed correctly in the assembly?
Good evening.
I figured out how to set the desired color for the lines of the playing field ( https://toster.ru/q/277335)
I assembled the build, launched it - the lines are still pink in the game. When run inside the editor - the lines of the desired color (black).
What could be the problem?
Line drawing code:
private void DrawLine(Vector3 start, Vector3 stop, GameObject template)
{
GameObject toInstiateGridLine = template;
GameObject gridLineInstance = Instantiate(toInstiateGridLine, start, Quaternion.identity) as GameObject;
LineRenderer gridLineRenderer = gridLineInstance.GetComponent<LineRenderer>();
gridLineRenderer.material.color = Color.black;
gridLineRenderer.SetVertexCount(2);
gridLineRenderer.SetWidth(0.01f, 0.01f);
gridLineRenderer.SetColors(Color.black, Color.black);
gridLineRenderer.SetPosition(0, start);
gridLineRenderer.SetPosition(1, stop);
}
Answer the question
In order to leave comments, you need to log in
this is the color of lines without material. add material to linerender.
For example:
gridLineRenderer.material=new Material(Shader.Find("Unlit/Color"));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question