playMaker

Author Topic: [SOLVED] Fade to invisible  (Read 5911 times)

Jernau

  • Playmaker Newbie
  • *
  • Posts: 19
[SOLVED] Fade to invisible
« 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?
« Last Edit: June 25, 2012, 09:11:51 AM by Alex Chouls »

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Fade to invisible
« Reply #1 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.
Best,
Sven

Jernau

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Fade to invisible
« Reply #2 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?

Jernau

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Fade to invisible
« Reply #3 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!

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Fade to invisible
« Reply #4 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
Best,
Sven

Jernau

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Fade to invisible
« Reply #5 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!