Author Topic: Play animation in a different Sprite with UIButtonPlayAnimation  (Read 5538 times)

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
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.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Play animation in a different Sprite with UIButtonPlayAnimation
« Reply #1 on: March 19, 2013, 08:32:15 AM »
aynone?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Play animation in a different Sprite with UIButtonPlayAnimation
« Reply #2 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".

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Play animation in a different Sprite with UIButtonPlayAnimation
« Reply #3 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Play animation in a different Sprite with UIButtonPlayAnimation
« Reply #4 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.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Play animation in a different Sprite with UIButtonPlayAnimation
« Reply #5 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Play animation in a different Sprite with UIButtonPlayAnimation
« Reply #6 on: March 22, 2013, 02:05:42 AM »
UIButtonPlayAnimation has a "target" parameter which determines which animation it will play.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Play animation in a different Sprite with UIButtonPlayAnimation
« Reply #7 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!)