Function AstarPath.BlockUntilCalculated

BlockUntilCalculated (Path path)

Blocks until the path has been calculated.

Public Static
void BlockUntilCalculated (

Path

path

The path to wait for. The path must be started, otherwise an exception will be thrown.

)

Blocks until the path has been calculated.

Normally it takes a few frames for a path to be calculated and returned. This function will ensure that the path will be calculated when this function returns and that the callback for that path has been called.

If requesting a lot of paths in one go and waiting for the last one to complete, it will calculate most of the paths in the queue (only most if using multithreading, all if not using multithreading).

Use this function only if you really need to. There is a point to spreading path calculations out over several frames. It smoothes out the framerate and makes sure requesting a large number of paths at the same time does not cause lag.

Note

Graph updates and other callbacks might get called during the execution of this function.

When the pathfinder is shutting down. I.e in OnDestroy, this function will not do anything.