D
D
Dmitry Demidov2016-01-25 22:39:12
Game development
Dmitry Demidov, 2016-01-25 22:39:12

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);
    }

Game:
60c8e015cfd54e7db0e1de7b0e83b4a6.PNG
Assembly:
3d4673b33ea4461489560afb5b52c56d.PNG
In addition, there is a feeling that the center lines are thicker than others. I would be grateful for any answer.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iundersun, 2016-01-26
@ptitca_zu

this is the color of lines without material. add material to linerender.
For example:

gridLineRenderer.material=new Material(Shader.Find("Unlit/Color"));

K
kezel, 2016-01-26
@kezel

assembly can be in different folders .. and resources are different ... for example, an old shader is lying around somewhere

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question