Is set destination for RichAI in update function will loss proformace?


recently i turn A* Path logging into heavy mode , and find out it’s run lots of unnecessary pathfind.

because i use RichAI.destination=$posV3 in tick function.

the output log like below:

Path Completed : Computation Time 0.021 ms Searched Nodes 0 Path Length 1
End Node
G: 0
H: 1346
F: 1346
Point: (40.0, 1.0, 38.0)
Graph: 0
Start Node
Point: (40.0, 1.0, 38.0)
Graph: 0
Path Number 56 (unique id)

the Start Node and End Node are both (40.0,1.0,38.0). and the navmesh will not change when the game start.

so is that kind pathfind will loss proformace?



The RichAI will recalculate the path regularly (set by the “repath rate” field in the inspector). How often you set the destination has no impact on this, and setting the destination is very cheap.
You can disable path recalculation using ai.canSearch = false if you want.