playMaker

Author Topic: Trail Color change  (Read 2684 times)

akadow

  • Playmaker Newbie
  • *
  • Posts: 8
Trail Color change
« on: March 08, 2019, 06:19:54 AM »
Hi there!

Is it possible to change the color of a trail renderer n event (trigger enter, etc)?


Thanks!

Doh

  • Full Member
  • ***
  • Posts: 124
Re: Trail Color change
« Reply #1 on: March 08, 2019, 08:36:04 AM »
Absolutely, you could do it a few ways including through the use of the "set material color" action. If you select the shader you want to use so that you can view its keywords in the inspector window, use that keyword in the "named color" part of the action, once that state is active it will change it to the colour you set. For example the particle shader I'm currently looking at has a "tint color" setting, the keyword for this would be "_TintColor".

akadow

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Trail Color change
« Reply #2 on: March 08, 2019, 01:03:42 PM »
Hi, thanks for the answer but with set material color I do not get Gradient Editor

Doh

  • Full Member
  • ***
  • Posts: 124
Re: Trail Color change
« Reply #3 on: March 09, 2019, 08:49:39 AM »
Sorry I didn't consider that, I actually looked for the same answer a while back and was told that Playmaker doesn't support gradients. I'm pretty sure I've used gradients on particles, but just to setup a black and white gradient, then I think I've controlled an overall tint through the material assigned to the particle. You may be able to go down that route. Best of luck with it!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Trail Color change
« Reply #4 on: March 10, 2019, 06:45:37 PM »
Hi.
From what i understand,
you are looking to be able to do this :
https://docs.unity3d.com/ScriptReference/TrailRenderer-colorGradient.html

I will see if i can make an action for this tomorrow (its already midnight here at the moment :) )

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Trail Color change
« Reply #5 on: March 11, 2019, 03:16:41 AM »
Djaydino, I made a line renderer gradient awhile back. You could probably just repurpose it and change it to be trail renderer instead of line renderer: http://hutonggames.com/playmakerforum/index.php?topic=15044.0

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Trail Color change
« Reply #6 on: March 11, 2019, 06:46:13 AM »
hi.
@tcmeric.
Great thx.
i will have a look.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Trail Color change
« Reply #7 on: March 11, 2019, 03:16:41 PM »
Hi.
Eventually i did not use arrays directly but you can choose the amount of color keys and alpha keys

Similar to multi actions.



I did not have much time to test so please let me know if they work :)

You can get them from the attachment below. (For line and trail)

Doh

  • Full Member
  • ***
  • Posts: 124
Re: Trail Color change
« Reply #8 on: March 11, 2019, 03:42:46 PM »
Now that's pretty snazzy!