I’m using multiple AI agents who using the “seeker(object).StartPath(currentPos,targetPos,OnPathComplete)” is initiating a move sequence.
However, I notice there’s a slight delay while it calculates that. It ranges from 1-3 seconds for few agents. I’m using almost 100-120 AI agents which can make the delay last for a good 10-15 seconds for a number of agents.
Am I doing something wrong or is this expected behavior?
Or is there any way to overcome this by using a better function?
Also, is there any way to actually find out if the AI is moving along a path. Not sure if “seeker(object).IsDone” is what I’m looking for here though.
Turn on logging (A* Inspector -> Settings -> Path Log Mode) to see how long each path takes to calculate.
It depends on how many nodes the request needs to search, i.e on how large the graph is, and how long your paths are.
10-15 seconds sound a lot though.
If you are writing your own script, then I guess you could add a bool: isMoving which is true after the OnPathComplete callback has been called.
The delay remains somewhere in the 5-10 seconds range but by adding Debug lines at various points in the code, I found out it’s because it’s returning a lot of “Null paths”.
The thing is the target remains within the defined graph (say (10,0,10)) and it returns null path for 4-5 secs before actually drawing its debug line and moving the AI agent.
Nonetheless, putting a “move” bool in that has atleast enabled me to put an Idle state for the AI agent when they’re not moving/still calculating/returning null paths.
What exactly do you mean with a null path. Most code works with linked lists, so they cannot loop over a number of null path objects by definition.
How many nodes does the path search?