Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: jeldrez on March 18, 2013, 12:35:08 PM

Title: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: jeldrez on March 18, 2013, 12:35:08 PM
How I play animations in a different sprite using UIButtonPlayAnimation, I want to press a button and move a different element.

I didn't realize how to do it.
Title: Re: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: jeldrez on March 19, 2013, 08:32:15 AM
aynone?
Title: Re: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: ArenMook on March 19, 2013, 09:53:46 PM
If you want to switch a sprite to a specific one, then do just that -- sprite.spriteName = "abc".
Title: Re: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: jeldrez on March 21, 2013, 07:40:08 AM
If you want to switch a sprite to a specific one, then do just that -- sprite.spriteName = "abc".
Sorry, but I didn't get it.
What I want it's moving other widgets pressing a button with PlayAnimation, not changing the name, or I'm not getting it?
Title: Re: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: ArenMook on March 21, 2013, 10:48:15 AM
I'm not sure what you are trying to do. UIButtonPlayAnimation allows you to trigger an animation. But you have to create this animation first using the Unity's animation window tool (CTRL+6). For how to create this animation, consult Unity's documentation.
Title: Re: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: jeldrez on March 21, 2013, 01:47:12 PM
I've already done the animations, but what I figure out it's that UIButtonPlayAnimation just play animations attached to the widget.


UIRoot
- Camera
-- Anchor
--- Panel1
---- Button1 (UIButtonPlayAnimation)
--- Panel2
--- Button2 (with animation attached) <- this should move when pressing Button1


I want when you press Button1 it moves Button2, so I attached animation on Button2. Because if I attached to Button1 it moves this button instead Button2.


I'm doing it wrong? that's not the way?
Title: Re: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: ArenMook on March 22, 2013, 02:05:42 AM
UIButtonPlayAnimation has a "target" parameter which determines which animation it will play.
Title: Re: Play animation in a different Sprite with UIButtonPlayAnimation
Post by: jeldrez on March 22, 2013, 01:54:20 PM
UIButtonPlayAnimation has a "target" parameter which determines which animation it will play.
Ohh, sorry, I was trying to drop just the animation on the target parameter, and that doesn't work, now I just drag and drop the widget that contains the animation and it works perfectly.

Thanks a lot Aren! (mostly for your patience!)