Search code examples
c#unity-game-enginevirtual-realitygoogle-vr

`UnityEngine.LineRenderer.SetColors(UnityEngine.Color, UnityEngine.Color)' is obsolete: `Use startColor, endColor or colorGradient instead.'


Game View with Play Again button on Canvas

Receiving this error in Unity version 5.6.0b7 : Assets/GoogleVR/Scripts/UI/GvrLaserPointer.cs(83,18): warning CS0618: UnityEngine.LineRenderer.SetColors(UnityEngine.Color, UnityEngine.Color)' is obsolete:Use startColor, endColor or colorGradient instead.'

Can't seem to get this right. Any ideas?


Solution

  • You need to do what it tells to do:

     lineRenderer.SetColors(Color.white, Color.black);
    

    becomes

    lineRenderer.startColor = Color.white;
    lineRenderer.endColor = Color.black
    

    Same will apply to SetWidth => start/endWidth

    And for the SetVertexCount => numPositions