Forum rules - please read before posting.

130k+ calls to Physics2D.OverlapCircleAll in scene with larger walkable area, momentary stuttering

edited October 2022 in Technical Q&A

[Unity 2021.3.11f1 - AC v1.75.8]

Hi Chris!

On quite a large scene (about 6116x2537) I have 3 separate NavMesh that I switch according to the state of the game, so only one NavMesh is actually considered at any given time (the switching only happens upon entering the scene, not while traversing it).

Almost every time I click\double-click to walk around in this scene, the character stutters for a brief moment. I went to check into the Profiler and this is what I have noticed.

The issue seems to be happening more often when interacting around the center of the scene, but I can't really confirm it's an actual behaviour.

This only happens in this scene, so far and has always happened throughout the production, even when there was only a single NavMesh inside the scene, but maybe different Unity versions made it less noticeable in the builds (although I have nothing to validate this statement).

My quite predictable guess would be that the NavMesh is too large and\or has too many sides, but maybe there's more to it?

In the past I remember trying splitting the NavMesh in half and switch between the two sides, but the switching and clicking was a bit difficult to handle especially when a player would try to reach the other side, etc.

Thanks a lot in advance!
Chris

Comments

  • Could you PM me the scene file along with your Player prefab and Manager assets, so that I could test things on my end? Graphic assets won't be necessary.

  • After talking with Chris via DMs, the temporary fix is to reduce the Accuracy on the NavMesh. The more I reduce it the less Physics2D.OverlapCircleAll calls I get in the Profiler.

    Also, even if I reduce it dramatically, I don't seem to notice any particular precision issue when walking around, so currently I don't see any downside doing that.

    As always, thanks again Chris!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.