Unity Editor - Freeze

When running my game in the editor, after X minutes the editor will freeze -
nothing reacts anymore, but there is also no crash.

When I checked with the profiler, there seemed to be a problem in AStarPath library,
possibly related to garbage collection - is this a known problem?

  • Unity 2021.2.5
  • AStarPath: 4.2.17

What I tried:

  • deleting the AStarPath Folder and re-importing everything → did not help.
  • switched from Mono to IL2CPP → did not help.
  • disabled AStar Gameobject while playing → no more freeze.
  • deactivated graph batching → did not help.

Edit: Problem has been solved.
This is what I suspect happened:

  • I used callbacks to react when end of a path was reached.
  • sometimes a destination was selected that was outside of the NavMesh.
  • I suspect that in this case, there was a problem with the callbacks (infinite loop?).

I fixed it by making sure every destination is always on the NavMesh,
and by eliminating the need for callbacks.

1 Like