Support Forum

ABPath.Construct doesn't fail when Seeker.StartPath Does


Firstly, I want to thank you for getting back so quickly, I really appreciate it.

I have some logic to figure out what’s blocking my character to get to their destination, so I can set my destination as whatever’s blocking my path.

This is a tower defense game, and I have buildings setting Tags on the graph rather than non-walkable nodes.

As you can see the tags are blocking the path here. So What I do is the following to figure out what’s in my way.

First: Check a normal path with tags constraint to make sure I can reach destination. If it passes, we have a clear path, so return out. (I use seeker.startPath for this as it has the constraints set on it already so it works, But I want to avoid using Seeker.startPath because it stops the characters current path. I want to use ABPath.Construct there.)

Secondly: If it fails then I do an ABPath.Construct with only walkable = true constraint to find a path ignoring buildings. I keep track of all the buildings (since they are marked with tags).

Thirdly: I use seeker.path to use the nodes provided in the second path to see which of these buildings I can get to using the Buildings tag Constraint. (again i dont want to use seeker here because it stops my current paths. I want to use ABPath.Construct)

Fourth: I Get the building thats actually blocking my path and attack that one.

Fifth: Set AIPath.Destination to this building

So this works, but Since im using Seeker.StartPath to calculate this info, My enemies stop moving when they calculate.

Now the only difference I believe here with Seeker.StartPath and ABPath.Construct is that i have to manually tell the ABPath to constraint on tags where as seeker has those tags set in the inspector.

This is what I do to avoid using Seeker.StartPath, because i felt like this would now have the same constraints as Seekers Path calculations.

Alas, this calculation doesn’t fail though.
If i use ABPath.Construct, and pass these constraints, call back doesnt return an Error, so i get stuck on my First step.
If i use Seeker.StartPath, my callback has an error since the path is blocked and it goes on to second step.

I am just curious, why Seeker fails properly, but the ABPath doesnt. Am i passing the constraints wrongfully?


You also need to set path.enabledTags

Thank you! That seem to solve that problem :slight_smile:

1 Like