playMaker

Author Topic: Line Renderer Set Gradient  (Read 1305 times)

tcmeric

  • Hero Member
  • *****
  • Posts: 648
    • View Profile
Line Renderer Set Gradient
« on: April 29, 2017, 01: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
« Last Edit: April 29, 2017, 01:19:42 AM by tcmeric »

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 123
    • View Profile
Re: Line Renderer Set Gradient
« Reply #1 on: April 30, 2017, 04: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!

tcmeric

  • Hero Member
  • *****
  • Posts: 648
    • View Profile
Re: Line Renderer Set Gradient
« Reply #2 on: April 30, 2017, 05: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?

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 123
    • View Profile
Re: Line Renderer Set Gradient
« Reply #3 on: April 30, 2017, 08: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.

tcmeric

  • Hero Member
  • *****
  • Posts: 648
    • View Profile
Re: Line Renderer Set Gradient
« Reply #4 on: April 30, 2017, 08: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

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 123
    • View Profile
Re: Line Renderer Set Gradient
« Reply #5 on: April 30, 2017, 11:46:21 AM »
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

tcmeric

  • Hero Member
  • *****
  • Posts: 648
    • View Profile
Re: Line Renderer Set Gradient
« Reply #6 on: April 30, 2017, 06: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.