Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Jernau on June 15, 2012, 09:57:17 AM

Title: [SOLVED] Fade to invisible
Post by: Jernau on June 15, 2012, 09:57:17 AM
I'm making a turn-based two-player game and have a Prefab which is used as the template for both player's pieces. The GameObject instances, generated from the prefab, determine at run-time if they're owned by player 1 or player 2 and set their Material Color accordingly. I would like to write an FSM on the Prefab that can fade the player piece from its player color to invisible, but I haven't been able to think of a good approach to achieve that.

My first thought was to store the Material Color in a Color variable and then animate its alpha channel using the Animate Color action. However, I can't find an action that allows me to get a Material's Color (only to set it).

Is there another approach to achieve a prefab-based "fade to invisible" using PlayMaker?
Title: Re: Fade to invisible
Post by: kiriri on June 16, 2012, 01:19:07 PM
about getting the material color, have you tried dragging in the material from the gameObject inspector onto your state action panel, then releasing the mouse and clicking get property. There should be an option for color.
Title: Re: Fade to invisible
Post by: Jernau on June 16, 2012, 04:43:35 PM
about getting the material color, have you tried dragging in the material from the gameObject inspector onto your state action panel, then releasing the mouse and clicking get property. There should be an option for color.
Thanks for the tip, but I couldn't find the color property using the technique you described. Have you tried this yourself and know that it works?
Title: Re: Fade to invisible
Post by: Jernau on June 16, 2012, 05:01:12 PM
I discovered that iTween has a FadeTo method that does exactly what I need. So I rolled up my sleeves and wrote my first PlayMaker Action (http://hutonggames.com/playmakerforum/index.php?topic=1777.0)!
Title: Re: Fade to invisible
Post by: kiriri on June 16, 2012, 05:37:57 PM
hmmm, and here I was trying to surprise you with this ultimately difficult "Get Color" action :P
Title: Re: Fade to invisible
Post by: Jernau on June 16, 2012, 06:32:31 PM
hmmm, and here I was trying to surprise you with this ultimately difficult "Get Color" action :P
Well, it was very kind of you to make it for me, thank you! :)

Even if I don't need it now, your Action might well come in handy down the road. Cheers!