Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: zarroc407 on July 17, 2017, 06:03:19 AM

Title: Need Help With Fading in an Object
Post by: zarroc407 on July 17, 2017, 06:03:19 AM
So I'm working in unity2d trying to help a friend make something for a presentation and I ran into a bit of a problem. I need to make it so I can click on a sprite and that sprite makes several others fade in. From what I understand the best way to do this by manipulating the alpha channel but what I can't figure out is how do I get the color information from the the sprite I want to fade in and then animate the change. Can anyone help me?
Title: Re: Need Help With Fading in an Object
Post by: Deek on July 17, 2017, 11:07:23 AM
The easiest approach would be to drag the Sprite Renderer component into the state you want to work in, choose 'Set Property', under 'Property' select color>Color, give that a variable, tick the checkbox 'Every Frame' and repeat that for every GameObject you want to fade in (they all should use the same variable).

Then add the action "Ease Color", in there you can set the start and end color (in your case from white with zero alpha (the 'A' when clicking on the color-field) to white with full alpha), under 'Color Variable' select the variable that you set in all Set Property's and the other options should be pretty self-explanatory.

Hope you could follow that  :P
Title: Re: Need Help With Fading in an Object
Post by: djaydino on July 18, 2017, 01:34:51 AM
Hi,
It is better to get proper actions for this as 'Get/Set Properties' break somethimes when you build.

You can find actions for this on the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)
Import it and search for : 'sprite color'

Then you can use "Ease Color" as Deek said.

if you need to use Get/Set properties for something you also should use Linker wizard to prevent breaking: