Problem with AstarPath.cs StartCoroutine in Awake ()

I was having problems with pathfinding on startup taking several 10s of seconds to complete even though it reported completion in only a few miliseconds.
I eventually tracked it down to a possible unity issue where a StartCoroutine in Awake () doesn’t always start properly.
I moved the ones you had in Awake () in AstarPath.cs to start () and my problems went away.

please see


Oh, I thought that Unity bug was fixed. I have indeed seen this before, but I thought Unity had fixed the issue since that. It seems to happen for a few unlucky users that Time.time is incorrectly set at Awake.
The workaround would be to, as you have done, place the call in Start instead, also using multithreading also solves the issue.

When I initially encountered this problem a few days ago I solved it (through trial and error) by moving pathfinding from my Start function to it’s own function which I then call from Start. The new function starts off with a yield WaitForSeconds(0.1) circumventing the issue. Now that I’m revisiting my workaround I’m glad to see you guys have already addressed this.