'How to add the Default-Line material back to the LineRenderer material?
If i'm starting with the linerenderer materials and the first place is empty without any material the linerenderer is pink and then i'm trying to add the Default-Line material to the linerenderer in the Start :
void Start()
{
myLineRenderer = GetComponent<LineRenderer>();
Material defaultLine = new Material(Shader.Find("Default-Line"));
myLineRenderer.material = defaultLine;
}
but the linerenderer materials is empty.
if i'm trying for example this it will add the Standard material :
private Color ggg(Color color)
{
Material standrad = new Material(Shader.Find("Standard"));
standrad.color = Color.red;
myLineRenderer.material = standrad;
return color;
}
So why it's not adding the Default-Line ? When adding the Default-Line the materials is empty.
Solution 1:[1]
This is because Unity has moved the addresses of the default materials. For default line; Copy the script below:
myLineRenderer.material = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply"));
In fact, you should follow its previous address from Shader.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | KiynL |

