How to acess the alpha component from a line renderer

Hey everyone,

My line renderer has a material assigned to it, that has a alpha component (particle additive).
I want to acess the alpha of the material, to change it at runtime.
This doens’t work :

path1.GetComponent(LineRenderer).renderer.material.color.a = 0.1;

Anyone knows how to do this ?
Thanks,
Bruno

I wanted to do essentially the same thing, this is how I was able to do it.

First - Use a particle material for the line renderer (I used Particles/Alpha Blended)
Then:

linerenderer.renderer.material.SetColor("_TintColor", new Color(1, 1, 1, 0.5f));

Seems to works ok for me so far, just have to set the color in the material instead of with the texture.

Vectrosity may well be a better solution in the long term, it is simply amazing in it’s power.

I’m running Unity 5.6.1f1 and following a tutorial done in an earlier version of Unity, where the Line Renderer Inspector UI looks a bit different. I like the new changes, but I cannot find the place to change the opacity of my Color. I’m using Particles/Alpha Blended for a laser beam, and in the Line Renderer I can set a nice gradient, but there’s no slider for alpha as in the tutorial video. Where did it go?

1 Like

Found it! On a gradient UI, the tabs below select color and the tabs above are for alpha.

9 Likes

thanks