Unable to use deep profile when using FollowerEntity

  • A* version: 5.2.4
  • Unity version: 2022.3.24 LTS

Not sure why but I am unable to use deep profile without almost completely lagging out the editor when I have around 200~ FollowerEntity in the world.

If I let it run for a bit then it improves slightly from 1-2fps to 10fps, but still the units are idle with no destination and path set and basically deep profiler just shows this (with local avoidance disabled on all entities):

The entities don’t have target set, so they are all idle:

I wish I could be of some help; as I have the same issue as well- I found disabling the A* manager object to help whenever I need to profile, otherwise the engine completely stalls. Hoping its some sort of bug that will get patched soon.

Yes, I wonder if you are using the new version as well?

I have a feeling it is slower performance than Unity AI navigation, but I cannot test for sure since profiler is not working properly with FollowerEntity!

This is unfortunately not easy to fix for me.
Unity’s ECS package has a lot of deeply nested small methods, and they add a lot of overhead when using deep profiling. Take a look at this screenshot:

Over a few seconds it racks up almost a million calls to IntPtr.op_Explicit, for example. This is a tiny method that really shouldn’t be profiled. Similarly, you can see a ton of other tiny methods that should be excluded from deep profiling, but instead add a ton of overhead. Burst.CompilerServices.Hint.Unlikely is even just an annotation method, it should compile down to nothing if handled properly.

I cannot solve this. However, you could petition for the Unity team to annotate more of their tiny methods with [IgnoredByDeepProfiler]. For the next update, I’ll add this attribute to more of my package’s tiny methods (like list accessors and such). But I’m afraid it will only make a small difference compared to all those unity internals.