Support Forum

Force path find

Hello how to force path find ?
I would like to check if there are any available paths before the AI receives the task.

        public bool CanReachTarget(Vector3 target)
        {
            var checkPath = CreatePath(target);
            AstarPath.StartPath(checkPath, true);
            return checkPath.IsDone() && !checkPath.error; // Always false, because the path is calculated for the next frame.
        }

You can call path.BlockUntilCalculated()

See https://arongranberg.com/astar/docs/path.html#BlockUntilCalculated

1 Like

thanks for the super quick response.

Path.Release() - call automatically after all calculations ? I am confused with another function. That is, you do not need to restore the work, it will start itself after the calculation?

@Any3Develop Path.Release is not called automatically.