Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Animations look different in preview than in game mode or in a single key frame

Discussion in 'Animation' started by terovania_cschaal, Dec 29, 2021.

  1. terovania_cschaal

    terovania_cschaal

    Joined:
    Jan 7, 2020
    Posts:
    11
    Hi everyone,

    right now we are dealing with a strange issue, affecting only the preview mode of the Unity animator:

    If we compare the preview mode (hitting the play button of the animation tool) with the actual keyframes, the movement of the character will look a lot different than viewing each key frame separate by moving the cursor of the timeline manually.

    Current behaviour:
    - When viewing the animation preview mode, all animations look very different compared to their keyframes
    - it looks like the transforms of the IK chains won't move smooth along with the bones that they are attached to, but keep stuck at wrong positions, influencing their bones behaviour in the wrong way
    - When selecting a single key frame, the animation looks normal an the IK solver's transforms will travel to their destinated coordinates

    The animations look completely normal when viewing them either keyframe by keyframe or when they are triggered in game mode. This only affects the preview of the animation window in scene mode. The IK solvers are shown in a total different position than they are supposed to.

    We have also created a GIF in order to show the difference. You can clearly see the different movements of arms and legs due to the different positions of the IK solvers:


    Expected behaviour:
    - The animations should look exactly as they are configured within the keyframes when they are played in the animation preview mode
    - IK solvers should move the same way as they are supposed to within their keyframes

    Environment:
    This behaviour can be expected in both Unity 2020.3.25 LTS with 2D animation package version 5.0.10 and also in latest Unity 2021.1 with 2D animation package version 7 on Windows 11.

    Additional information:
    The issue suddendly started to occur, without any modifications to the packages. Someday the issue appeared and has been resolvable by simply restarting the Unity editor for a few times, but it has now become a permanent issue, preventing our animators from doing their work because they can't properly use the animation preview.

    Please also note that we have seen that there has been an fixed issue in version 5.0.8. of Unity 2D animation that sounds very similiar to our issue ("Fixed an issue where IK Solvers would not be updated when previewing an animation clip. (1364597)").

    However, we actually had these problems beginning way later and we are currently using a version in which that issue should be actually fixed.

    Thanks for your help in advance!

    Kind regards,
    Christian
     
    cmetric3d and Unrighteouss like this.
  2. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    573
    Hello @terovania_cschaal,
    I recently had a look at a bug report where the user reported a similar issue. In that bug report the user animated both the bone transforms and the IK solver, causing the animation system and the IK system to fight over the final position of the bone transform. Could this be the issue in your case as well?
     
  3. terovania_cschaal

    terovania_cschaal

    Joined:
    Jan 7, 2020
    Posts:
    11
    Hi @Ted_Wikman and thanks for your response.

    This has also been my first thought. You mean it might be caused by animating both the transform position or the IK solver and the transform position of the bone that the IK solver is attached to in separate keyframe properties?

    But even if that's the cause, I don't understand why:
    • The animations still looks perfectly fine in Play mode
    • The single keyframes look as expected when scrolling through the timeline
    • The issue started to occur randomly and it was possible to avoid the wrong behaviour at first sometimes by simply restarting the Unity editor, before it has become a permanent issue
    • Even older animations that used to work perfectly fine for over a year now are suddenly broken when playing their preview, even though we didn't make any changes to them
    All the points described above speak for an issue with the Unity editor from my point of view. The position of transforms should always be the same in the Animator preview like it's in play mode or when viewing a single keyframe within the timeline. If they suddenly don't match with each other anymore, I assume that this is a graphical issue of the Unity editor.

    We have also submitted a bug report, I can send you the link via private message.

    Thanks for your help and best regards,
    Christian

     
  4. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    573
    Knowing if you have one transform being both targeted by the IK system and also having its position and/or rotation being keyed and animated in a clip is a vital piece of information in this question though. If this is indeed your setup, then I am curious what you are trying to accomplish with that kind of setup, as you have two systems fighting over setting the final position and rotation of the transform.

    I'm happy to take a closer look at this issue, so do send any projects and/or bug reports my way!
     
  5. terovania_cschaal

    terovania_cschaal

    Joined:
    Jan 7, 2020
    Posts:
    11
    Hi @Ted_Wikman, many thanks for the quick reply! I wrote you a private message with the fogbugz URL to the related bug report.
    In the meantime, I'll try to figure out the current IK set-up with my animator team and if the combination of IK solver and bone position that you have described is also the case in our project.
     
  6. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    573
    Great, thanks! I'll take a peek in the coming days.
     
  7. terovania_cschaal

    terovania_cschaal

    Joined:
    Jan 7, 2020
    Posts:
    11
    Note: We just did a rollback to Unity version 2020.3.17 and downgraded the 2D Animation package to version 5.0.7. Using this version, all animations look like they did before in the animator preview.

    I therefore assume that this fix in 2D animation package ver 5.0.8 (highlighted in the screenshot below) has something to do with our issue:

    upload_2022-1-7_15-13-54.png
     
    Unrighteouss likes this.
  8. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    259
    Hello,

    I'm experiencing the exact same issue, and I submitted a bug report for it around 3 weeks ago. I just got an update on that bug report with this reply:
    ---
    Hi,

    Thanks for getting in touch, we actually know about this and you can check the status here:
    https://issuetracker.unity3d.com/product/unity/issues/guid/1387137

    The is by design. When animating IK, affected bone transforms should not be individually animated. This will cause the two systems (Animation and IK) to fight each other over the final bone transform position. The fix is to either choose to animate using IK or keying individual bone transforms.

    Please reach out to me if I can answer any questions or be of further help.

    Thanks,
    Ugnius
    Customer QA Team
    ---

    I've already replied to this, but it took 3 weeks to get a reply to my ticket last time, so I'm making a post here as this is extremely concerning.

    I already explained this in my report, but animating any bones that change the position of anything in the chain breaks preview playback (the pelvis affecting leg bone positions for example). It's not just animating bones in the chain.

    This behavior is clearly not by design. The animation works correctly everywhere except during preview playback (runtime, manually looking at frames, etc).

    If you could provide some additional information on this, I would greatly appreciate it @Ted_Wikman

    Thank you.
     
    Last edited: Jan 13, 2022 at 3:49 PM
    terovania_cschaal likes this.
  9. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    573
    Thank you for reaching out, @Unrighteouss. First off, sorry for the current lead time. We managed to accumulate quite a few tasks over the holidays, and we are slowly getting back to a more reasonable response time on bug tickets and general requests.

    In the past bug reports, I only got to see animation clips animating bones in the IK chain. Like I previously wrote in this thread, I am not sure what the intent is and the appropriate end result would look like. However, if there are issues when animating a bone outside of the IK chain, then I fully agree that this is a bug.

    In the past few days, @terovania_cschaal and I have been in contact, and I have received a good repro project. Once we (2D Animation team) clear some more pressing matters, we will shift focus and take a proper look at this issue.

    Thanks again for being persistent and letting us know more about the issue.
     
    terovania_cschaal likes this.
  10. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    259
    Thank you for your reply @Ted_Wikman

    I apologize if I'm coming off as impatient; I've had to work around this bug for weeks, so I was a little shocked when I read that it wasn't going to be fixed.

    It's very simple to reproduce. Here is a video showing the bug in action: https://drive.google.com/file/d/1sbdC67v8P4cK-64Ag7G6lCqxE3yc4sR-/view?usp=sharing

    The only bone being animated in the video is the pelvis, and the IK looks different during preview playback compared to runtime. There is no special setup, I'm just using a few bones with a single Limb chain.

    This behavior is very problematic for me, as I'm unable to preview what an animation actually looks like, which makes animating very difficult and much more time consuming. The video may not look like a big deal, but the result can get much worse with more complex animations.

    Here is the zipped project I was using in the video: https://drive.google.com/file/d/11YmiuuKmrjGMmf7onGB3KZHJJdPC0GHv/view?usp=sharing

    If you require any additional information or files, please let me know.
     
    Last edited: Jan 14, 2022 at 6:53 AM
    terovania_cschaal likes this.
  11. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    259
    @terovania_cschaal found that 2D Animation 5.0.8 is where the bug first appears. I can confirm this. Testing on 5.0.7, everything works and the bug is nowhere to be found. Updating to 5.0.8 immediately introduces the bug.

    Here is a video of 5.0.7: https://drive.google.com/file/d/15BrAjzz06gmZCKsWq5vcp9uU7rE7tsJ6/view?usp=sharing

    I animate the pelvis, as well as the hip bone (which is a bone in the IK chain), and it still works perfectly. Something changed in 5.0.8 seems to be the cause of the bug. Hopefully that helps narrow it down @Ted_Wikman

    I also tested Unity 2019.4 and 2021.2, and the bug was not present in 2019's IK package (2.2.0-preview.1), but it was present in 2021's 2D Animation package 7.0.3.
     
    Last edited: Jan 14, 2022 at 7:43 PM
    terovania_cschaal likes this.
  12. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    573
    Thanks for your help @Unrighteouss. I had a closer look yesterday, and I believe I have found the issue. I'll do more testing in the coming days to verify the issue and the fix. Stay tuned :)
     
  13. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    573
    Status update: I had the chance to test my fix further today and it seems like a solid one. The fix has been handed over to QA for verification. Do note that it will take some time to backport the fix if it is approved by QA. If you are in dire need of a fix, DM me and I'll see what I can do to help you get unstuck.

    Thanks again for the assistance with this issue. If you would like to follow the bugs progress, have a look at this link: https://issuetracker.unity3d.com/issues/animations-look-different-in-preview
     
unityunity