Support Forum

Multiple Graphs and FloodPath

Hi. I’m using a GridGraph with FloodPaths for navigation of enemies in my TD game. I’ve two flood paths, one to get from enemy gate to the treasure location and another to get back from the treasure location back to the gate. The navigation worked perfectly.

Then I wanted to implement some other logic, which could me modelled as connecting certain points on the map in a graph and then traversing them. So I decided to use a PointGraph for it. I created it in Unity inspector. I created a custom tag for the gameobjects that wanted to include in this graph. When I run the game and create new game objects with the custom tag, it creates appropriate nodes and connections in the PointGraph. I can see them in the editor. The problem is, when an enemy is trying to return back from treasure to the gate using the floodpath, it gives an error " Couldn’t find a node close to the start point".

In the Seeker component on the enemy I’ve chosen the Grid graph, so I expect that it won’t use the PointGraph for its navigation. So I don’t understand why I’m getting above error.

If I disable the point graph, then the navigation works again.

I looked into the FloodPath code to investigate and I see that in its prepare routine it finds its start node by this line of code

var startNNInfo  = AstarPath.active.GetNearest(originalStartPoint, nnConstraint);

I could not find any way to tell the FloodPath about which graph to use. So I’m not sure if the error I’m getting above is caused by the FloodPath using the PointGraph and not the GridGraph.

I know that the error implies that my enemy might be far away from any point on the node, but that couldn’t be the case because I can visually see its location in the editor. Besides the flood path from Enemy gate to the treasure is working fine.

Any clarification you might add to help?
Thanks.