Function is not working or I'm using it bad?

Hello,
I was following documentation in order to create turn based strategy in 2D and got idea how to get my tiles highlighted if they are currently walkable, but it seems like function “BlockUntilCalculated()” is not working.

    public bool Scan(Vector3 unitPosition, Vector3 tilePosition, int tileSpeed)
    {
        var path = ABPath.Construct(unitPosition, tilePosition, null);

        path.traversalProvider = traversalProvider;

        AstarPath.StartPath(path);
        path.BlockUntilCalculated();
        Debug.Log("Path was found with " + path.vectorPath.Count + " nodes");

        int tileDistance = path.vectorPath.Count - 1;
        if(tileDistance <= tileSpeed)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

For some reason my computation time is 0,00ms and because of that I can’t mark properly my walkable tiles. Could someone help or advise me how to highlight all tiles in range of x from path searcher? I can’t afford the pro version, so I’m looking for other solutions.

Edit: I’ve tried to use coroutine but it didn’t help.

Hi

I cannot see anything wrong with that code. “Computation time 0.00ms” just means it barely took any time at all to calculate the path, it doesn’t indicate an error.

Hello,

But warning says “Path Failed. Error: The node closest to the start point could not be traversed.” It turns out 0 everytime, it doesn’t even try to traverse so I can’t read distance between If start point could not be traversed that means it could not took any time because it did not happened.

That means your ITraversalProvider says that the node which you want the path to start from is not actually walkable. I am guessing that your ITraversalProvider also includes the unit itself as unwalkable, which is problematic since you want to include that node in the path.