Author Topic: UI Play Animation cant find animation from Unity 4.3.X  (Read 17438 times)

Nerosam

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
UI Play Animation cant find animation from Unity 4.3.X
« on: November 30, 2013, 02:18:27 PM »
I just updated to Unity 4.3.X and it seems that the animation system update has broken UIPlayAnimation...slightly When I create an animation on any object (by clicking on the object, clicking on animation clip dropdown list in animation window and creating a new clip), it creates an animator component on that object and a seperate .anim file and animator controller file. I figured I should just remove the animator component and manually create the usual animation component on that object instead while referencing the new .anim file. But UIPlay animation keeps throwing this error at me:-

  1. Default clip could not be found in attached animations list.
  2. UnityEngine.Animation:Play()
  3. ActiveAnimation:Play(String, Direction) (at Assets/NGUI/Scripts/Internal/ActiveAnimation.cs:175)
  4. ActiveAnimation:Play(Animation, String, Direction, EnableCondition, DisableCondition) (at Assets/NGUI/Scripts/Internal/ActiveAnimation.cs:228)
  5. UIPlayAnimation:Play(Boolean) (at Assets/NGUI/Scripts/Interaction/UIPlayAnimation.cs:196)
  6. UIPlayAnimation:OnClick() (at Assets/NGUI/Scripts/Interaction/UIPlayAnimation.cs:145)
  7. UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
  8. UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:783)
  9. UICamera:ProcessTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:1375)
  10. UICamera:ProcessMouse() (at Assets/NGUI/Scripts/UI/UICamera.cs:1081)
  11. UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:947)
  12.  

Im also getting a warning which says:-

  1. The AnimationClip 'Menu - Main Menu' used by the Animation component 'Window Root - Main Menu' must be marked as Legacy.
  2.  

I believe NGUI is looking for something that only the older version created because as soon as I tried an animation from one of your examples, it worked perfectly again.

I did however manage to create an original legacy clip by first creating an animation component on the object, and then creating the animation clip from the animation window.

Message to NGUI Devs, you might want to add the "work around" steps to your documentation.

Hope this helps someone somehow...spent many days and nights pulling my small afro hairs out on this.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #1 on: November 30, 2013, 04:48:06 PM »
Curious... thanks, I'll keep that in mind and will see about making it work with either.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #2 on: January 21, 2014, 02:32:37 PM »
Yeah, animations are not working now. At least for me.

detomato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #3 on: January 25, 2014, 03:51:35 PM »
I spend the whole night wondering if I did something wrong, cause I cant get the animation to get working. Urghh!!
I open up previous scene and it works okay, but seem to be broken in latest Unity?

Any solution for that?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #4 on: January 25, 2014, 03:58:24 PM »
Unity changed the animation system, making the old system "legacy" and the new one, based on mecanim, the primary one. They've done so in a way that actively prevents people from using the old system even if they want to, and they didn't bother do any kind of upgrading logic. So instead of working with the Animation component, you now have to work with Animator. They're different systems that sound the same, and it's very easy to get confused. NGUI was always based on the old system (Animation), and doesn't support the new one (Animator). It's on the list of things for me to address in the near future, but you can use it if you like... you just can't use NGUI's UIPlayAnimation script to activate your animations.

detomato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #5 on: January 27, 2014, 03:58:24 AM »
Hi, if I cant use the UIPlayAnimation script anymore, meaning I have to come out with my own script? I'm not a programmer, and not sure how to get it done. I just need the toggle animation. Is there any workaround?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #6 on: January 27, 2014, 09:40:42 AM »
Well, to put it this way... the new animation system (Animator) is not suitable for anything generic, at least from everything I've seen. It's complicated to use, it requires a lot of overhead, and while powerful it also makes trivial things incredibly complex.

For example with the old animation setting something to move from point A to point B was a breeze. Record a frame in point A, record a frame in point B. To check if something is playing, do animation.IsPlaying. Once the animation reaches the end, it simply ends (unless you set it to loop).

With the animator... you can still record animation from A to B, but as soon as you hit Play, the animation will start playing endlessly. You then have to go into the actual state machine and define different states instead in order to get it to work as you'd expect. Even so, to check if something is playing, you have to know states by name. So it's not a simple matter of looping through all animation states and checking IsPlaying to see if they are playing. You actually have to know the animation state by name, which means having it be hard-coded in your code somewhere.

To determine if the animation has finished, you could transition to some specific "end" state in the animator, and check your animator to see if it's in that state... but then you'd have to ensure that all animators that are used by NGUI check for that specific state name (read: hard-coded), and that users actually know to set up the transition in the first place...

In other words, it's a goddamn pain in the ass to create a generic system around. This is why I haven't done it yet. There is no clean way of doing it that I saw. Everything that was trivial in the old animation system is ridiculously complex in the new one.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #7 on: January 27, 2014, 09:44:24 AM »
P.S. Oh, and UI animations need to be independent of Time.timeScale. I got around it in the old system by sampling it myself. The state-based animator is simply not suitable for that.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #8 on: January 27, 2014, 10:39:32 AM »
Changing the old animations is working, but creating new ones it doesn't. :'(

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #9 on: January 27, 2014, 10:49:38 AM »
Yeah it's extremely disappointing to me that Unity chose to fat out remove any way of creating legacy animations. I've had many frustrating times in the past where I had to open Unity 3.5 just to create an animation for myself.

That said, I've just extended UIPlayAnimation to support the new animation system, but there are some limitations. I will post more when I flesh it all out.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #10 on: January 27, 2014, 11:46:07 AM »
So... I stand corrected. The Animator isn't as bad anymore. It has quite a few new undocumented functions that add the support for everything I needed. And as a hidden feature, it does support passing 'null' for the clip name, and works fine. Although there is no documentation on any of it I was able to get it all working. So the next version will let you use UIPlayAnimation to play Animator recordings.

detomato

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #11 on: January 27, 2014, 02:18:38 PM »
Thanks for the head up. For now, I will just use the older version to create animation.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #12 on: January 29, 2014, 10:10:11 AM »
Aren, could you create a tut for the new anims? or is not really necessary?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #13 on: January 29, 2014, 10:11:31 AM »
CTRL+6, hit record, move the widget, move the time, move the widget. :P

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: UI Play Animation cant find animation from Unity 4.3.X
« Reply #14 on: February 12, 2014, 05:28:15 PM »
Yeah, with the last version works properly.

Thanks!