Function Path.BlockUntilCalculated

BlockUntilCalculated ()

Blocks until this path has been calculated and returned.

Public
void BlockUntilCalculated ()

Blocks until this path has been calculated and returned.

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.

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.

var path = seeker.StartPath(transform.position, transform.position + Vector3.forward * 10, OnPathComplete);
path.BlockUntilCalculated();

// The path is calculated now, and the OnPathComplete callback has been called

See

This is equivalent to calling AstarPath.BlockUntilCalculated(Path)

WaitForPath