Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

MAJOR Animator Bug introduced in 2018.8 causing performance issues.

Discussion in 'Animation' started by Paulo-Henrique025, Dec 1, 2018.

  1. Paulo-Henrique025

    Paulo-Henrique025

    Joined:
    Dec 12, 2010
    Posts:
    227
    The tittle actually refers to Unity 2018.2.8, sorry for this typo.

    After updating from 2018.1.9 to 2018.2.18 the performance in my application dropped significantly, with some parts dropping bellow 10fps. Upon a couple days of investigation I found the culprit to be Animators that have a RectTransform animation inside them, this bug started in 2018.2.8 and affects the following releases:

    2018.2.8
    2018.2.9
    2018.2.10
    2018.2.11
    2018.2.12
    2018.2.13
    2018.2.14
    2018.2.15
    2018.2.16
    2018.2.17
    2018.2.18
    2019.1

    The Bug:
    Having any Animation that moves a RectTransform inside an Animator will make it update the UI, every frame, even if the Animation has already finished or is not even playing. It is so extreme that even having an unconnected node inside the Animator with this kind of Animation will trigger the bug, and it will use resources every frame as if the objects were being updated.

    Here is the setup, an Animator that plays an empty node, plus a node that has an Animation that moves the RectTransform of 5 buttons to the right and back.



    Here is the game view and project hierarchy, each button has the same Animator.



    These button are not playing any Animation, they just have an Animator that has one node with Animation that is not playing , and will never be played.

    Profiler Results

    - 2018.2.6

    Nothing out of the ordinary.

    - 2018.2.7

    No problems with this release.

    - 2018.2.8 - It begins here

    There are a total of FIVE calls, one for each button, to SendReapplyDrivenProperties, as if these buttons were playing animations, this is called every frame forever until the application is stopped.

    - 2018.2.18

    These may seem like small performance hits but in a complex scene it can amount to hundreds of wasted calls, every object that has an stopped Animation has the same weight as if it was animating, all at the same time.

    I am sure this is affecting many developers around without their knowledge, it may looks like your game got somewhat slower after updating, but the true culprit is here and is crawling around for quite a long time, over 10 releases have this bug.

    Is this already know? If it is, is there and ETA for its fix?

    Thank you.


    Edit:

    The submitted bug report is Case 1105874
     

    Attached Files:

    Last edited: Dec 2, 2018
  2. LurkingNinjaDev

    LurkingNinjaDev

    Joined:
    Jan 20, 2015
    Posts:
    1,905
    - what is 2018.8? (2018.1 or 2018.2 or 2018.3?)
    - did you hear that animating UI from mecanim is not the best idea?
    - have you profiled this inside the editor or in a build?
    - have you submitted a bug report? what is the case number?
    - could you reupload your bugtest package in .zip format? a lot of people does not use RAR anymore because zip is everywhere and it does not requires extra software on windows
     
  3. Paulo-Henrique025

    Paulo-Henrique025

    Joined:
    Dec 12, 2010
    Posts:
    227
    Thank you friend, I correct the issues with the post and uploaded the zip version.

    Not the best Idea but still quite doable, and it runs well on all my target platforms.

    I have an unanswered ticket with the support, I will check to see if any of my colleagues already submitted the report and will update with the case number as soon as I get it.

    Profiled both in editor and on the target device.
     
  4. TinnusAquiris

    TinnusAquiris

    Joined:
    Nov 18, 2016
    Posts:
    1
    Hi, I'm working with Paulo on this, here to chime in about the issue.
    As a meta-note, that is beside the point. We have several launched and in-operation games using Animators in the UI, where we got to an acceptable level of performance and quality. The problem here is that a Unity update completely broke performance for us in these projects, and we're at risk of not being able to update Unity versions in the future for them due to this (or having to implement expensive workarounds), putting their future maintenance at great risk.
     
  5. LurkingNinjaDev

    LurkingNinjaDev

    Joined:
    Jan 20, 2015
    Posts:
    1,905
    Hi guys,

    during the weekend I tried your test-project in various versions of Unity, I have experienced the same behavior as you did, so the SendReapplyDrivenProperties() was called on every animated object, but I haven't experienced any performance problems, even when I put 500 buttons in the scene the cost of this call was below 1ms.

    I know, what is the problem, it was a "security" question/observation, since I don't know too much about your projects, I know whatever he shared with me. I don't know how big your project is, and I have my doubts that your measurements is right. I don't see the root cause being in these calls why your application is dropping below 10fps (all the screen shots show negligible amount of time, minimum milliseconds).

    My advice is: open a bug report and upload your real project with it if possible. Because I believe, this does not shows your claim at all. It does not cause performance issues in reasonable circumstances. Or you can upload this one with a note that you noticed the calls and you have performance issues which you believe caused by these calls but you weren't able to attach your real example.
     
  6. Paulo-Henrique025

    Paulo-Henrique025

    Joined:
    Dec 12, 2010
    Posts:
    227
    I believe that would be because the UI to be rebuilt is quite simple and cheap, when you got a few nested layout groups, content size fitter and other modifiers it can amass to a huge performance hit.
     
  7. LurkingNinjaDev

    LurkingNinjaDev

    Joined:
    Jan 20, 2015
    Posts:
    1,905
    That's possible.
    If you get response to your bug report, would you please post it here? I'm curious about what's happening and I believe I'm not alone with this. (Sorry I couldn't really be much helpful)
     
  8. Paulo-Henrique025

    Paulo-Henrique025

    Joined:
    Dec 12, 2010
    Posts:
    227
    Your willfulness in helping and being able to repro the issue is more than enough! Thank you very much!
     
  9. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    267
    There is indeed a performance regression, though it has been caused by a change in the UI system to fix another issue related to Animating UI, not really a change in the Animation System.

    I have notified the devs on the UI team, and I believe they should be able to give you more details soon.