Standard Shader with Linerenderer

Hi,
I have a series of distancejoint2d’s forming a chain and at the starting link, a linerender is attached which draws a repeated material over all of the chains points:

[SerializeField]
    LineRenderer lineRenderer;

    [SerializeField]
    Transform[] links;

    [SerializeField]
    float lineWidth = 0.1f;

    void Awake()
    {
        lineRenderer.SetVertexCount(links.Length);
        lineRenderer.SetWidth(lineWidth, lineWidth);
        lineRenderer.material.SetTextureScale("_MainTex", new Vector2(links.Length, 1f));
    }

    void Update()
    {
        for(int i = 0; i < links.Length; i++)
        {
            lineRenderer.SetPosition(i, links[i].position);
        }
    }

The attached material is using the standard shader with an albedo, normal and emissive texture.
The problem I am having is the line is always solid black.
This material is crucial to fitting in the the rest of the scene.
Any help as to why this is happening or how to work around it?

We are having the same problem here, with Additive shader it works fine, but we need to use the standard. I havent’t found any solution. Our texture is a cutout and the line takes the shape but always black. It only is happening to us in windows, in Mac it works fine…

Have you find the solution?

Thanks!

Did you find a solution to this?

Back in 2015 the LineRenderer didn’t support tangents (and maybe not even normals - i cant remember) so using lit shaders was a problem.

As of Unity 2017 (maybe even 5.6!) there is a checkbox in the inspector to generate lighting data for the line. Enable it and the Standard Shader (or any other lit shader) should work just fine :slight_smile: