Support Forum

Couldn't find a node close to the end point

Using Unity 2019.3.6f (with pro version 4.2.14), i’ve come across a weird situation where ABPath.Construct returns the warning below, but only if the GameObject with the Pathfinder component, isn’t first selected in the inspector:

Path Failed : Computation Time 0.00 ms Searched Nodes 0
Error: Couldn’t find a node close to the end point

Process that prompts the warning above:

  1. Enter Play Mode
  2. Call ABPath.Construct
  3. Warning prompted

Process that works as expected:

  1. Enter Play Mode
  2. Click on the GameObject which has the Pathfinder component attached to it in the inspector
  3. Call ABPath.Construct
  4. Path is calculated correctly and without warning

I’m creating the graphs at runtime with the following:

        private GridGraph CreateGraph(int width, int depth, int cellSize = 1)
            GridGraph   gridGraph = as GridGraph;
                        gridGraph.rotation.x = -90;
                        gridGraph.SetDimensions(width, depth, cellSize);
                        gridGraph.collision.heightCheck = false;
                        gridGraph.collision.collisionCheck = false;

            return gridGraph;

Query that prompts the warning:

		ABPath path = ABPath.Construct(start, target, (p) =>
			// path calculated

Other notes:
The warning is only prompted if the GameObject with the Pathfinder component hasn’t been clicked on that session; once it has been clicked, it can be unselected in the inspector and everything continues to function as expected.

Any help or advise as to what might be going on would be great, thanks!

That’s odd.

When you do

Are you sure you call ABPath.Construct after you have created the grid graph?

I am, yep. I trigger ABPath.Construct manually, once everything’s loaded.

I have no idea what could cause that. Would it be possible for your to share a small example project which shows this issue?