Bool based on "No open points, the start node didn't open any nodes"

Hi,

I have a particular area within the grid that some units cannot access. This was done by adding tags around this area.

I have a player and an enemy chasing him. When the player enters this area the enemy will not go there as the tags prevent it from doing so (so far so good)

I get this error when this happens “No open points, the start node didn’t open any nodes”

So what I would like to do is that as soon as this error shows up the enemy will give up. It can be a bool, string whatever as long as I can check it.

I tracked the error which resides based on this if statement in the ABPath.cs

//any nodes left to search?
            if (pathHandler.HeapEmpty ()) {
                if (calculatePartial) {
                    CompleteState = PathCompleteState.Partial;
                    Trace (partialBestTarget);
                } else {
                    Error ();
                    LogError ("No open points, the start node didn't open any nodes");
                    return;
                }
            }

I tried to check the documentation and use if(p.error) ecc… but nothing is working and I assume because this is not actually an error.

My only solution so far is to place a bool within the ABPath script which i can then call from another script but I would like to avoid doing this due to updates to the script that will come from Aron in the future.

Perhaps there something in unity that I can check the log for erros and do actions based on this?

Any help would be much appreciated it.

Hi

It will be logged as an error. In the OnPathComplete method the p.error field should be true and the p.errorLog variable should contain that text.
Note that if the p.error field is true in the OnPathComplete method in the AIPath script, it will completely discard that path, so you cannot just use the stored path variable.