Animator controller performance

Hello dev

So I was working on my pedestrian system today, and I noticed stress level in the profiler when my humans up to 50, the profiler keep showing animator.update() at 200sec , which is very bad…

Guys is there a way to optimize the animator to stay on multiple characters

Please anyone

you might need to try
(but can’t help you, I haven’t)
https://github.com/Unity-Technologies/Animation-Instancing

https://github.com/sonilyan/Unity-Animation-Instancing
https://github.com/chenjd/Render-Crowd-Of-Animated-Characters

otherwise you might also try to reduce characters’s bones, polygons, parts, animator layers

I can’t imagine that running full animator controllers for every pedestrian is a good idea. I’d maybe use it for nearby people, and something designed for bulk animation for anyone at medium and long distances.

If you’re rendering lots of something you want to re-use as much of the computation as you can.

Of course, disregard this if it already has bulk optimisations I’m unaware of.

1 Like

200 seconds for 50 Entities cant only be the animator something else must be going on, a thread sleep in a key frame event listener? :slight_smile:

1 Like

Thanks

Nope my profiler says so

1 Like

The first thing you should consider is how many bones are being exposed after importing a rigged model as this is one of the causes of bad performance.

Assuming you are only exposing the bones you absolutely need…

  1. You mention having 50 people but don’t specify if they are all within the view frustum at the time? The reason I say this is because, if some are outside, then it depends if you have setup stuff correctly (ie - culling animation)

  2. You don’t mention anything about if you have layers, etc parameter amounts, etc

  3. No information about how you are controlling the animation states (maybe you’re calling them in Update which would be why you’re performance is bad… who knows?)

You’ve given practically nothing in terms of information (not even a screenshot of the profiler) … not really sure how you expect anyone to help with anything considering the amount of variables there are in optimising something like crowd animations.

1 Like

I assumed that was either a typo or a misunderstanding. 200 milliseconds is the sim running slowly. 200 seconds between frames may as well be crashed, and I think on modern OSes will be treated as such.

1 Like

Yeah, that’s why my thread sleep comment :slight_smile:

At my dayjob we have database queries that update a few hundred thousands rows. Those take a few seconds. 200 seconds is a lifetime for a computer :slight_smile:

Edit: 200ms is still way too much offcourse :slight_smile:

Exactly, although the computer I’m using is weak, here’s the spec

2.66ghz dual core

It uses 4 threads

8gb ram

Nvidia GeForce 310m

Dx10

But I have reduce close speed to 1.44ghz because of CPU throttle…

What do you think sir ?

I think it’s my PC overall performance

2.66ghz dual core

It uses 4 threads

8gb ram

Nvidia GeForce 310m

Dx10

But I have reduce close speed to 1.44ghz because of CPU throttle…

What do you think sir ?

We’d need to know more detail, such as bone count and how the animators are set up and how many are on screen at once. And probably other animator specific stuff I’m not familiar with.

i followed up your method , now performance has finally been stabled , what I did is this , I only spawn like ten to 15 humans instead of 100 close to the player controller, then as player changes position pedestrians get pulled from point were player is not to were player is , just so the system don’t go through the instantiate thing again,

Then I changed animation update from physics update to unscaled Time.

Thanks for your support man…

1 Like

You’re welcome! :slight_smile:

You probably want scaled time instead of unscaled. Otherwise it’ll ignore changes to Time.timeScale, so things like pausing won’t work.

If you were using physics time that’s quite possibly a contributing factor, as it may have been updating multiple times per rendered frame.

Also, note that on the animator itself you can control whether animation is done all the time or just when the object is “visible” (ie: inside the view frustum - I don’t believe it checks occlusion). Unless your animations are being used to drive or raise events for other systems, you only want them doing their thing when the player can see them.

Yes for the animator I selected complete culling

You have saved me a lot of time…

Thank you sir for your support,

1 Like