Performance profiling result (Deterministic Move takes too much cycles??)

chrisk

Active member
Hi, Justin,

I was curious about the performance and here is the profile result.
It seems like Deterministic Move is taking the most time and out of Move, UpdateAnimator is taking the major portion.
I'm not moving the character at all and it seems bit too much for Move and UpdateAnimator, don't you think?

As a side note, is it possible to disable the Deterministic Move? Perhaps make it a normal Update to save some CPU time.
If do that, what would be the side-effect?

Thank you very much.

Cheers!


1545747942112.png
 
Unfortunately there isn't much that I can do to reduce the cost of Animators.Update. This is Unity actually doing the updating of all of the animators. If you have multiple agents you could add some type of culling system so if the character isn't in view then the animator won't update.
As a side note, is it possible to disable the Deterministic Move? Perhaps make it a normal Update to save some CPU time.
If do that, what would be the side-effect?
The controller is designed around being a deterministic controller so it would be a lot of work to switching everything over to just the Update loop. You could try playing with the fixed timestep to reduce the number of times the physics loop runs which may help.
 
Hi Justin.
Can you say, is it possible to create in one scene on mobile 15 simple NPCs (Non-Player Character, for excample SLOW zombie) using UCC + Behaviour designer, which can be idle, move, rotate, melee (with hands or some melee weapon) and die?

When I create zombie NPC like a default first person character (UCC) with AI (BD) and copy it 15 times in my scene to get 15 NPCs , I get about 10 frames per second or even less.

How can I simplify zombie character (UCC settings, animator settings) to get more frames per second ?

Or I should I use another character controller with BD? But in this case I will get a problem to use my ItemTypes by NPCs.

How can I create a lightweith version of UCC for NPCs ?

How can I change fixed timestep only for zombies?

What fixed timestep do you recommend to set for mobile game with UCC+BD Non-Player Characters with amount about 15 - 30 ?
 
Hi, Justin.
What about "new documentation topic after 2.1 is released for what you can do to improve performance".

I have not noticed performance boost in 2.1 on mobile devices.

I have too low fps with even 10 ai :(
 
Right now the thread linked to is a good overview of what to do. I have some culling ideas planned for the 2.1 series and after I finish with that I plan on writing the docs since it is more specific to UCC.

You definitely should have seen some type of performance gain though - have you tried profiling on the mobile device?
 
The Animator's default update runs on Unity's Update. UCC updates the animator manually on FixedUpdate, regardless of FPS.

On iOS devices, the display is locked at a multiple of 30 fps. Even if the game can make 60 fps, most games limit to 30 fps to keep the device from overheating / draining the battery.

In other words, by default, UCC is updating the animator 70% more times than Unity's default behavior. Also, if you use animator culling, UCC ignores it.

(BTW, you could try increasing the fixed Timestep, but you do so at the expense of the physics system's accuracy)

@chrisk , try setting the AnimatorMonitor's m_DebugAnimatorController to true, and change the AnimatorMonitor code to let it run on device (currently the code is only for UNITY_EDITOR).. and give it a try. In our case, the performance improved considerably.
 
@chrisk , try setting the AnimatorMonitor's m_DebugAnimatorController to true, and change the AnimatorMonitor code to let it run on device (currently the code is only for UNITY_EDITOR).. and give it a try. In our case, the performance improved considerably.

Justin, what do you think about this improvement?
 
I have been planning on doing a quality of life update and planned on including the change which lets you specify when the animator is updated. I'll see if I can get this change in 2.1.1 and do a 2.1.1 release next week. You won't have deterministic root motion values with this setup but it's more important to be able to run smoothly than have accurate root motion values in this case.
 
Looking forwards to this also, not sure witch scenario is best for me, but if we can add more NPCs with the same frame rate will be awesome. Performance will be better then as the UpdateAnimator won't take so much time?
 
I have been planning on doing a quality of life update and planned on including the change which lets you specify when the animator is updated. I'll see if I can get this change in 2.1.1 and do a 2.1.1 release next week. You won't have deterministic root motion values with this setup but it's more important to be able to run smoothly than have accurate root motion values in this case.

Hi, any new about this update ?
 
That change is in place - the animator is no longer updated by the controller's updated loop.
 
ApplyOnAnimatorMove is killing my performance.
I have tried to reduce the number of clip to 144, deleting the IK component, removing the ik passe in the animator controller, disabling root motion, and enabling animator culling.
Any clues ?

(using a 16 threads CPU)

Thanks by advance.
 
What within ApplyOnAnimatorMove is taking up most of the time?

Also, it looks like UltimateCharacterLocomotion.OnAnimatorMove is running in 0.51ms out of the 88ms so something else is causing the majority of the spike.
 
I am not sure of what you are asking me, here is more screenshoots :
There is a lot of FixedUpdate.DirectorFixedUpdate in the profiler, each one take about 5 ms to complete.
There is 20 agents in the scene.
 
OnAnimatorMove is likely being called multiple times because of the low framerate and the fixed timestep. If you change the animator to Animator.Update it will no longer update the animator at a fixed rate, though I think that the current version changes the animator to AnimatePhysics automatically. I'll make the change in the next version so it lets you keep the Animator.Update setting.
 
Top