Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: tcmeric on April 29, 2017, 04:17:16 AM

Title: Line Renderer Set Gradient
Post by: tcmeric on April 29, 2017, 04:17:16 AM
So in 5.5, you cannot set a color to a line renderer anymore because it now uses a gradient. (I think its from 5.5 forward).

I needed a 2 color gradient for my lines, so I wrote this. Of course it could also work for 1 color, if you just set both colors to be the same. It also allows you to set the color location, alpha amount and alpha location (time). Basically everything you need to set a color gradient on a line renderer.

Enjoy: https://github.com/dumbgamedev/general-playmaker/tree/master/lineRenderer
Title: Re: Line Renderer Set Gradient
Post by: LordHorusNL on April 30, 2017, 07:56:43 AM
This is exactly what i needed, the current linerender action with 5.5 has a few flaws and this fixes one of the biggest for me!

Awesome, thanks!
Title: Re: Line Renderer Set Gradient
Post by: tcmeric on April 30, 2017, 08:32:43 AM
Nice. Thanks for letting me know that it is helpful for you.

What bugs have you noticed with the line renderer in 5.5? Anything in specific?
Title: Re: Line Renderer Set Gradient
Post by: LordHorusNL on April 30, 2017, 11:31:45 AM
Ohh i was thinking of the draw line action, not the linerenderer itself sorry.

When using the draw line action on a motion controller (Vive) when moving the controller the line always lags behind, even when in late update.
I've noticed the laserpointers in VRTK show the same behaviour.

I've not noticed any other bugs in the linerenderer itself.
Title: Re: Line Renderer Set Gradient
Post by: tcmeric on April 30, 2017, 11:56:33 AM
I wonder if something like vectoristy might be more performant. However, I dont have any experience with implementing it.

https://www.assetstore.unity3d.com/en/#!/content/82
Title: Re: Line Renderer Set Gradient
Post by: LordHorusNL on April 30, 2017, 02:46:21 PM
I'm aware of vectrosity however it's difficult to justify purchasing a 30 dollar asset everytime i run into something unity can't do out of the box.

And that seems to happen far too often :P
Title: Re: Line Renderer Set Gradient
Post by: tcmeric on April 30, 2017, 09:41:58 PM
Haha, true. But then again, there will always be someone out there who can do it better and then does (and then sells it). Which is cool by me. Innovation.
Title: Re: Line Renderer Set Gradient
Post by: S0ULART on June 30, 2021, 08:59:30 PM
does anyone has the corresponding GetLineRendererGradient action to this?
That would be amazing since I cant figure out how to write it myself and failed.
Title: Re: Line Renderer Set Gradient
Post by: S0ULART on July 07, 2021, 02:16:56 PM
*Please anyone
Title: Re: Line Renderer Set Gradient
Post by: djaydino on July 10, 2021, 07:36:41 AM
Hi.
I think that you need to get this from the material.
you can use : 'Get Material Property Block Float' (instance) or Get Material Float (Material Itself)

probably the named float will be _Gradient but it depends on the material