Hey everyone,
I noticed that in one of my scenes, the game was lagging pretty significantly every time I clicked somewhere to move so I looked into the profiler and the spikes result from over 400k Physics2D.OverlapCircleAll per click.
All other scenes in the game do not cause any trouble - we are working with AC V. 1.83.0
I already tried lowering the destination accuracy of the pathfinding but that did not seem to help so far.
I tested a much simpler NavMesh, and that does seem to make the problem go away. However, in this particular scene, a rather complex NavMesh is needed to make the navigation of the set geometry work. I noticed that there are 2 other posts about this topic, however, neither of the proposed solutions worked for me. I would prefer not to switch to another pathfinding method.
Any ideas where I might have gone wrong?
Best,
ACV
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Could you share details/screenshots about the shape of the NavMesh?
If it's particularly complex, I would advise you switch to A Star 2D pathfinding in the Scene Manager. It doesn't require a rebuild of your NavMesh - it'll still use the same Polygon Collider.
I did not realize the pathfinding method could be switched per scene! Thank you Chris, that did fix our issue. A Star 2D does feel slightly less accurate though - are there any settings you recommend for this particular method?
You can reduce the "Cell size" field in the NavMesh's Inspector to improve accuracy.