Support => NGUI 3 Support => Topic started by: pixelplacement on July 02, 2012, 01:44:31 PM
Title: Animate alpha through AnimationClip
Post by: pixelplacement on July 02, 2012, 01:44:31 PM
Is there a way to do this other than an in-between script with a public float that is telling sprites to update their color? Would be nice to be able to animate alpha directly though an animation clip. Thank you for everything.
Title: Re: Animate alpha through AnimationClip
Post by: ArenMook on July 02, 2012, 01:45:15 PM
Nope, you have to use the in-between script. Widget alpha has to be set via properties, and you can't use properties in animations.
Title: Re: Animate alpha through AnimationClip
Post by: pixelplacement on July 02, 2012, 01:54:38 PM
Will do. Thank you very much.
Title: Re: Animate alpha through AnimationClip
Post by: Sarus on September 06, 2012, 07:39:31 AM
Nope, you have to use the in-between script. Widget alpha has to be set via properties, and you can't use properties in animations.
Hi Arenmook,
Sorry to bring up an old thread but can you elaborate a little on how to use the in-between script in conjunction with the "UIButton Play Animation" script? Basically right now I have a Unity animation that moves a sprite off the screen. I hooked this up to a button and use the "UIButton Play Animation" script to trigger the animation that translates the sprite. At the same time (as the sprite is moving) I'd like it to fade out by adjusting it's alpha. The simplest thing would be if alpha could be modified in the animation (it shows up as MColor.a in the animation editor and will change the alpha of the sprite's Color Tint in the inspector but doesn't seem to actually change how the sprite looks in game).
Since this won't work how could I sync the animation (which handles translation) with changing the alpha from 1 to 0 (255 to 0) over the course of the translate animation? I'd like to keep using the "UIButton Play Animation" script because it so incredibly useful and easy to setup. Thank you for all your help!
~Sarus
Title: Re: Animate alpha through AnimationClip
Post by: ArenMook on September 06, 2012, 07:43:27 AM
You'll still use UIButtonPlayAnimation, as that's what you use to trigger the animation. MColor is a private variable, and Unity should not be showing it (the fact that it does is a bug on Unity's part). You can't modify it directly. Animate the alpha of this script instead: