A* Pathfinding Project  3.8.2
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
Optimization

There are various ways to increase the performance of the system.

  • By far the easiest way is to enable multithreading (A* Inspector -> Settings). This will make the pathfinding run on a separate thread instead of on the Unity thread which will likely improve performance quite a bit since almost all computers and even phones these days have multiple cores.
  • Also make sure "Show Graphs" (bottom of A* inspector) is disabled. For large graphs the overhead of drawing it every frame can severely slow down the game (this only applies to the editor, not a standalone game).
  • Logging path results has a pretty large performance impact. Often as much as reducing the pathfinding throughput by 50%. You should disable path logging if you do not need it. Set A* Inspector -> Settings -> Path Log Mode to None.
  • Another thing to think about is what graph type you are going to use. Grid graphs is the easiest type to get started with but it cannot handle very large worlds (kilometers or larger in size). The recast graph can do that and is also a lot faster than the grid graph at smaller sizes since it usually contains a lot fewer nodes. The drawback is that it is slower to scan and is not as flexible when it comes to updating it during runtime. But if you have a static level you almost definitely should go with a recast graph.

See the child pages for more ways to increase the perfomance.