Occasional large delay when searching path

I’m using AIPath for my movement. After an initial call to AIPath.StartPath, there is usually a pretty fast return to the callback AIPath.OnPathComplete. However, sometimes (maybe 1 times in 15), the callback takes a long time, anywhere from 2 to 10 seconds. This is unfortunately very hard to reproduce.

Is there anything that rings a bell that could be causing this?

I’ve noticed a similar bug and I suspect something about the initial delay in AIPath.TrySearchPath(), but I wasn’t able to clearly identify the problem.

Isn’t this bug related to this one :
“problem with AstarPath.cs StartCoroutine in Awake ()”
http://arongranberg.com/vanillaforums/discussion/322/problem-with-astarpath-cs-startcoroutine-in-awake

And has a side note, my game start in pause mode (Time.timeScale set to zero in Start() of my Pause script). But when the delay occurs, it is after I release the Pause.

Hmmm, very interesting. I’ve moved some of the AstarPath Awake code into the Start function. I should know within a few days if this helps.

Thank you :slight_smile:

Sry, late reply on this. Your suggestion seems to have fixed the problem. Thank you