Support Forum

Performance issues with PerformBlockingActiions on Switch

Hello all,

please give me your suggestions about the performance issue I have.

In order to let our creature find a path in a direction the creature faces, I place a U-shaped blocker around the creature’s position by instantiating a prefab with a collision. Then I update A* with;;

Once the path is calculated, I remove the blocker out of the navmesh. I do cache flush requests, so I update astar once per frame, not once per creature (I have 16 of them on a map).

Everything works fine on a PC, but on a Switch we have periodical framerate drops every 10 or 15 seconds of a gameplay, which is very annoying. Profiler gives following timings:

Seems like PerformBlockingActions is the main reason. It seems like it is happening because of that blocker placement. Are there any ways to fix this issue?

Unity 2018.4.24, Astar pathfinding project 4.2.8 (according to changelog), Pro version. I use Recast navimesh, 512x512 in size.

Best regards, Artem.

Few more notes.

The biggest problem for us is the 1M+ of a garbage. The given screenshot illustrates exactly this. We are wondering if we can do something with the garbage using the blocker insertion or we should use a different approach to make rounded paths? Would you please point us to the proper solution in a few words?



May I suggest a simpler version of just calculating a path from a point a few units ahead of the creature?
That will give you essentially the same result. If necessary you can patch the start of the path by inserting a segment from the current position of the creature to the previous start point of the path.

Hi Aron,

thanks for your suggestions. It was really nice of you to spend your time to help us.

The idea with the blocker was not the first one I implemented to achieve rounded paths. If I calculate a path with a start point in a few units ahead, the resulting path would sometimes come through the real starting point, which is what we are trying to avoid. If I move the fake start point to either left or right side of the creature and then patch the resulting path with segments, unsmoothed result could be better, but smoothing it with either funnel or raycast modifier could cut that segments away and we still have sharp turns of the creature. The blocker solved all these issues but with the price of GC on a Switch.

I would appreciate any other ideas.

Best regards, Artem.