Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: akadow on March 08, 2019, 06:19:54 AM

Title: Trail Color change
Post by: akadow 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!
Title: Re: Trail Color change
Post by: Doh 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".
Title: Re: Trail Color change
Post by: akadow on March 08, 2019, 01:03:42 PM
Hi, thanks for the answer but with set material color I do not get Gradient Editor
Title: Re: Trail Color change
Post by: Doh 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!
Title: Re: Trail Color change
Post by: djaydino 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 :) )
Title: Re: Trail Color change
Post by: tcmeric 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
Title: Re: Trail Color change
Post by: djaydino on March 11, 2019, 06:46:13 AM
hi.
@tcmeric.
Great thx.
i will have a look.
Title: Re: Trail Color change
Post by: djaydino 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.

(https://i.imgur.com/geyEwT2m.png)

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)
Title: Re: Trail Color change
Post by: Doh on March 11, 2019, 03:42:46 PM
Now that's pretty snazzy!