Path.vectorPath always 1 after graph update

Hi

Using LayeredGridGraph.
Using default Seeker component.
Using ABPath;

I’m using AIPath to move my character. I created a simple subclass which basically handles clicks in order to place the target transform where the player clicks on the floor.

After opening a door, I call AstarPath.active.UpdateGraphs(bounds); This works great. I can see the graph update in the scene with the doorway now walkable through.

Problem:

Creating new paths always seems to return a path with one entry in the path.vectorPath (basically right on top of the character). This is only a problem after doing a AstarPath.active.UpdateGraphs(bounds);. If I don’t do the graph update I can’t walk through the doorway, but the path.vectorPath issue doesn’t happen.

It doesn’t matter where I place the target transform. It always returns a path with one vectorPath coordinate. What am I doing wrong?

Note:

For some unknown reason… If I pause the Unity Scene, manually move the character a little bit and then press resume, it starts working again as expected. :frowning:

Hi

I would suggest checking if your character object is in a layer that is included in the ‘Height Testing’ or ‘Collision Testing’ masks in the grid graph settings. If it is included in the height testing mask, the graph might generate a node on the character’s head and it will not be connected to anything else which is why it thinks it cannot move anywhere.

Ah yes. That does ring a bell. I wondered why it was generating those above the character’s head. I’ll give it a go and let you know.

Thanks for the quick reply!

That worked.

Thank you very much!

1 Like