Author Topic: Animation issue  (Read 3764 times)

Tito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Animation issue
« on: November 04, 2014, 07:21:13 PM »
I have a question on animations - specifically leading from the documentation page on UIPlayAnimationation http://www.tasharen.com/forum/index.php?topic=6762

I had a look at the Checkmark animation and the way it works on the colored checkbox. However the only way I could get my own animations to work within NGUI was to create them directly onto a UISprite and take it from there - which is quite different. Also while this worked fine in windows preview mode - it didn't work at all on an Android target device. Also even when I got it working on windows, scaling the animation had no effect.

So:
  • How was the checkmark animation created? ...because using a list of frames in the animator is not giving me the same thing.
  • How do you scale the animation in a device independant way so that it can be used on varying android devices?
  • Is the "Working in preview but not on Android" issue ringing any bells for anyone?

Been going in circles for several hours on this one.. (since 2pm.. it's now 12.30 am) ... so all info appreciated.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Animation issue
« Reply #1 on: November 06, 2014, 01:21:58 AM »
The checkmark animation was created back in Unity 3, so it is using the older animation system. Regardless though, NGUI supports the new one just fine. UIPlayAnimation triggers a remote animation. Things to watch out for include making sure that your animation isn't set to play on awake, and if you animate the scale or position you need to make sure that the panel drawing that widget isn't marked as static.

I don't understand the scale question. Device independent? Scale is just that -- scale. Widgets normally have a scale of (1, 1, 1). Not sure what that has to do with your question.

Tito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Animation issue
« Reply #2 on: November 06, 2014, 12:47:32 PM »
Still getting nothing. Here's how I'm creating it:

Open animation window
Create a sprite in hierarchy - click on it
In animation window "Create curve" - file saved in animation folder
Drag texture sprites from asset folder (type sprite2d, pivot center, pixels to units 1, filtermode point, 16bit)
create NGUI UISprite in the relevant panel
Add animation component with the test animation set to be the animation and element 0 of the animations
Turn play auto off
Add ui play animation component to button and set animation to be the NGUI UISprite defined 2 steps ago

I'm getting nothing


Alternatively if I make it the Unity Sprite I defined in the first place it is playing in the scene window and I can see it playing in the animator, but it is not visible in the game window.

Not at all clear what I should be doing now.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Animation issue
« Reply #3 on: November 07, 2014, 01:40:06 PM »
Sprites cannot be changed via the Unity's animation window. You can animate the scale, position, etc -- but you can't alter the sprite's texture. The NGUI's animation for the checkmark animates its scale, nothing else. To change sprites, use UISpriteAnimation, or do it via code similar to how it's done inside that script.