Mecanim, a sad story

Today I had to tell our animator to stop animating our game and take a break because he was getting so frustrated to try and create animations because of Mecanim.

This is for a 2D game that uses Mecanim. So whenever I’m talking about rotations, I talk about Euler rotations of the form (0,0,Z).

When updating from 5.3.1p1 to 5.3.4p1, we noticed that whenever you try to rotate an object, it will clamp this value between 0 and 360. This might not seem like a big deal as this is mathematically correct but when it comes to interpolation between these key frames it is a world of difference. When you want to rotate something from 10 to -10, you want it to interpolate it between 10 and -10 with intermediate values such as 4, 0, -6, … and not between 10 and 350 with intermediate values such as 20, 60, 180, 284, … This causes that our animator had to manually drag the curves in the Animation view back down in order to make sure the animation would not completely spas out.

The interpolation values were set on Quaternion Interpolation, so he tried to set them to Euler Angles instead. This caused not only the rotations to be completely broken but the editor also caused an “AABB error spam” to occur due to it seemingly complaining that some rotations were NaN.

When I decided to try the newest Unity 5.3.5f1 to see if the issue where rotations were no longer clamped 0-360, I saw that when pressing play that a game object rotation no longer was animated and its value was locked to the prefab value. This was tested with the original animations that worked in 5.3.4p1, not ones that were created when experimenting.
The clamping issue was also not fixed.

We have been using Mecanim since Unity 4.3 and loved it but it seems that it feels like the amount of critical and annoying bugs have been rising with every build.

Some examples of (lesser) annoying bugs that worked in 4.3 but have been introduced since then but have not yet been fixed for as far as we known:

  1. Create a new game object by dragging a prefab into the scene. Select the child that has an Animator. Open the Animation window. Unity will tell “To begin animating …, create an Animation Clip.”. You need to then select another object and click it again before you can see your list of animations (confirmed in 5.3.5f1).

  2. When modifying a prefab which has an animator that is not the root, whenever you miss click, the root of the object will be selected. This causes the root of the prefab to be selected. Since this root object does not have the animator, you will need to click the animator again and you will also need to select the animation, the frame that you were editing and the gameobject. Breaking the prefab instance clears this but it still is annoying. (confirmed in 5.3.5f1)

  3. Sometimes when animating, the actual values of the prefab will suddenly be overwritten instead. (Happened in 5.3.1p1 for him, visually confirmed by me, can’t tell you the repro steps though. Not sure if it is fixed in 5.3.5f1)

  4. Sometimes when animating, the Animation window refuses to record any further actions. (Happened in 5.3.1p1, visually confirmed by me, can’t tell you the repro steps though. Not sure if it is fixed in 5.3.5f1)

  5. Sometimes the scroll bars in the Animation Window are not there when they should (Confirmed 5.3.5f1).

Hopefully we will see more love for the Mecanim system soon as it can be something that can achieve great things and awesome animations and we would love to keep on using it and give this sad story a happy ending after all :).

1 Like

I was just in the right mood to post about the exact same issues, but gladly you already did in a much more composed way than I would have.

Using 5.3.5f1 I can confirm the clamped rotations and #2, which is broken by design. To add to the list of annoying things:

  1. Trying to adjust an animation curve point usually results in moving the whole animation curve up and down, which is in my opinion broken by design, since no one ever needed such behavior (!)

  2. Undo only updates the animated properties in the scene view when changing the current time in the timeline window.

  3. The fact that you can’t select and move animation keyframes and animation events simultaneously.

Edit
If you accidentally animate the parent object (thanks to #2), animated position and rotation properties of your child object is f#?k!d. Neither undo, nor removing the parent’s position/rotation properties restore the previous animation…

To resolve your 6th issue, simply click somewhere else, then drag the point. It will drag the entire curve if you a) drag the line next to it by mistake or b) have all the points selected, which can happen.

It sounds like these are the problems that @Hertzole is also running into.

@zortech These are issues that our animator has found as well.
@aer0ace That post only talks about 1 of the issues mentioned here; namely the 0-360 clamping.

Our animator found a new issue:
9) In the Animation Window, when pasting a key frame which has a lot of elements (50+ curves), it doesn’t seem to paste the entire list of elements, instead you will need to press paste 5 times before it finally has pasted everything it needed to. (5.3.1p1)

As an update, we had to revert to 5.3.1p1 since we know there are less issues there. Hopefully the Unity Devs will notice these issues and fix them in a nearby patch :).

  1. The timeline editor won’t select frame #500 anymore as shown in the gif. I can still move the keyframe to that time, but …
  • Whenever I click the “Go to next/prev key frame” buttons and it would be #500, it just doesn’t do anything
  • If I type “500” in the frame time input field, it jumps to 499 instead
  • Some other frames have been randomly moved by +/- 1 frame as well … #500 isn’t the only one that’s suddenly broken

Repo: (on 5.3.5f1 and 5.3.1f1)

  • Create animator on camera, set (any) Position & Rotation Key on Frame #1
  • Try to select frame #500
  • Good job, you successfully broke it

Edit:
500 : Always switches to 499
1014 : Appears twice in the timeline … 1013, 1014, 1014, 1015

#StableRelease

2666152--188118--UnityAnimationFrames.gif

Any response from Unity on this issue?

I’d love to hear some response as well!

Has this worked before? I’ve seen this issue posted about as far back as 2010, but Unity remains silent…

This is kind of a larger game dev issue than just with unity (the whole 0-360 degree interpolation problem) because these issues come up while dealing with Euler angles in general. Interpolation (the built in ways to interpolate) generally doesn’t care what type of data it is handed and won’t know that 0 and 360 are equal without some more sophisticated information of the specific use-case and situation, and I think this is the way it is in most engines isn’t it?

I have ran into that problem a few times, and the usual way I deal with it is either check for that happening (like check if you were just under 90 degrees, crossed over to greater than 270 degrees without stopping in between) and stop the interpolation, and just manually move it back across the 0. It sucks though, because it makes animations look bad, and game mechanics not work right… just twitchy to break the interpolation like that…

I’d bet that within this knowledgeable forum however, that somebody wise knows a much more effective way to deal with that very issue (even if it doesn’t necessarily relate directly to interpolation and animation) than I could come up with.

@Patrascu @awesomedata The 0-360 issue works since Patch 5.3.5p6. ( Download Archive ) Also the issue where some transforms would no longer rotate properly has been fixed.

Hopefully some of the lesser annoying bugs will also be fixed but at least the 2 major bugs are reverted back to when they worked and we can update our Unity versions again. :slight_smile:

2 Likes

I’m currently doing a quick pass on the Animation forums, and have just stumbled upon this thread.

I’m fairly certain most of those issues have been fixed at this point. I know for a fact that I fixed some of them, but It’s hard to tell without bug numbers.

If you have reported those issues as bugs, with enough information for one of our QAs to reproduce them, they will get triaged, and most get fixed. For example, just for 5.4, over 180 animation bugs were fixed (http://unity3d.com/unity/beta/unity5.4.0f2)

We R&D devs don’t necessarily browse the forums that often, but we do at the very least look at every single reproducible bug that gets sent our way, so the most efficient way to get your issues fixed, and/or get the devs’ attention is definitely to report them.

Feel free to discuss them on the forums, but please post the bug numbers along with them, this way we can investigate them properly, and actually tell you when/if your issues were fixed.

Not only that, but sometimes, if we can’t immediately fix your bug, we can suggest workarounds from the bug report.

3 Likes

I’m willing to let devs know on slack if they subscribe to wanting to be told about threads which have issues (let the cm team know if that’s the case ie alice or sara).

1 Like

Not a complaint just a suggestion - @Mecanim-Dev seemed to be the only unity dev to assist in the animation section of the forum, however he has not been around for quite a while.
It’d be really HELPFUL if it were possible for some animation related devs to perform quick passes a more often, or even better, frequent the animation thread a bit more often. Just to have ‘actual’ Unity support hereabouts. :wink:

Well… Mecanim-dev has been on vacation for the past 4 weeks, so that’s definitely part of it.

I understand where you’re coming from, but any time we take answering questions is time we don’t spend
1- fixing bugs that block thousands of people
2- writing tests to avoid creating bugs while we do #1
3- improving performance
4- improving workflows and usability

So, what I’m saying is, I’ll make a big effort to come interact on the forums instead of browsing Facebook while I compile, but it’s pretty hard to form thoughtful answers in 5 minute increments.

1 Like

@DavidGeoffroy
The perception that I had when I wrote the first post in this thread was that Mecanim was (nearly) abandoned.

  • Critical bugs in new Unity versions.
  • Old bugs that never get fixed.
  • No devs active on forum.

Luckily this perception drastically changed now that I know 180+ animation bugs will be fixed in Unity 5.4., that is amazingly awesome news although at the same time it’s kind of scary to know there is a Unity 5.3. version that managed to go live with 180+ animation bugs in it.

For the whole “More devs on forums” discussion, I’m fine with seeing what devs do just by reading the change logs on new Unity versions but when not a lot is happening in a lot of consecutive patches and no devs are active on the forum either I start to worry about what is going on, although next time I’ll know to check the patch notes of the beta branch as well.

So one again DavidGeoffroy, thanks for taking your time to read and reply to this thread but most importantly thanks for fixing a lot of bugs.

Happy end.

I love Unity, but right now there are so many issues with the Mecanim

  • recently finding out that virtual methods of StateMachineBehaviors ended up in release version and didn’t work in beta version 5.6,
  • No encapsulation in terms of “Any State” nodes to their SubStateMachine
  • cannot transition to “Entry” and “Exit” nodes of SubStateMachine (would only introduce a tiny overhead looking through potential states into which to transition when Exit node is hit manually)
  • Cycle offsets in Animator States are not working when we change value in Parameters section
    -Cycle offset is not working from the moment of game start IF the state playback speed is initially zero.
  • GetComponent<Animator>().speed = 0; is not working as expected, like a global control for the animator’s playback speed
  • cannot “copy” serialized values form StateMachineBehaviour instance, like we can from a monobehavior component

I just want to quote one amazing post from here, which made me kek

And the best responses we were getting for several years is along the lines of “hm, we will be working on it” or “that might end up on the spotlight” and other sh*tposts

and in reallity they are working on some POS like “Animation: Added tracking of Animator State Machine view positions” (I am not kidding, it’s in release notes here)

I wish there was way more information/tutorials on how to use Mecanim.