AIBase.Update() Performance Issues With Large Amounts of Units

Good afternoon!

First off, I want to say thanks for providing such a stellar package. It’s really been a huge help because I found myself running into walls with the native pathfinding and it’s allowed me to make really great progress.

My problem is centered around performance issues with large numbers of agents. I’ve just recently switched over to the jobs workflow in my project and I’m trying to push the boundaries with the burst compiler. I’ve gotten my update loop down to around ~1.5ms, which is fantastic, but it appears that the primary bottleneck now is the AIBase.Update() method.

As you can see, I have almost 800 agents in the scene and the Update loop (while incredibly efficient at 0.04ms per unit) is still pushing on my Main thread a little harder than I would like. The good news is that this number doesn’t really change all that much once they start moving around, but I was wondering if my setup is inefficient, or if there are some optimizations I could be taking advantage of?

My A* Settings

I’m not using rigidbodies so I’ve already eliminated FixedUpdate from the AIBase script, but I don’t know if there’s anything else I could be doing. Also, these numbers are with gravity disabled. If I turn on gravity then performance drops by about half.

Any help, assistance or feedback would be greatly appreciated!




Nice work on the optimizations so far!
If you haven’t already, there is a page with a few more things you could look at for optimization here: