playMaker

Author Topic: Trail Color change  (Read 544 times)

akadow

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Trail Color change
« on: March 08, 2019, 04: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
    • View Profile
Re: Trail Color change
« Reply #1 on: March 08, 2019, 06: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
    • View Profile
Re: Trail Color change
« Reply #2 on: March 08, 2019, 11:03:42 AM »
Hi, thanks for the answer but with set material color I do not get Gradient Editor

Doh

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Re: Trail Color change
« Reply #3 on: March 09, 2019, 06: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: 4611
    • View Profile
    • jinxtergames
Re: Trail Color change
« Reply #4 on: March 10, 2019, 03: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: 740
    • View Profile
Re: Trail Color change
« Reply #5 on: March 11, 2019, 12: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: 4611
    • View Profile
    • jinxtergames
Re: Trail Color change
« Reply #6 on: March 11, 2019, 03:46:13 AM »
hi.
@tcmeric.
Great thx.
i will have a look.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4611
    • View Profile
    • jinxtergames
Re: Trail Color change
« Reply #7 on: March 11, 2019, 12: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
    • View Profile
Re: Trail Color change
« Reply #8 on: March 11, 2019, 12:42:46 PM »
Now that's pretty snazzy!