A* Pathfinding Project  4.1.16
The A* Pathfinding Project for Unity 3D
Error messages

Detailed explanations of various error messages that you may see when using the package.

Path error messages

These are errors that you may get when searching for paths. None of these errors are fatal in any way, it just means that the system couldn't find a valid path for some reason.

Couldn't find a node close to the start point

When a path request is started it will query the pathfinding system for the closest node (a node is one tile in a grid graph, one triangle in a navmesh/recast graph and one point in a PointGraph) to the start point of the path. This search has a limited range, though usually it is more than enough for all practical purposes. So if you try to request a path starting from some point that is nowhere near any (walkable) nodes on any graph then this error will be logged.

Ways to resolve this error:

  • Make sure that the starting point of your path request is correct.
  • If you are using one of the included movement scripts, make sure that the AI starts somewhere reasonably close to the graph.
  • If you that your starting point *is* correct and you really do want to just extend the search, then increase the AstarPath.maxNearestNodeDistance field. However know that having to search very far for the closest node may have an impact on performance.

Couldn't find a node close to the end point

This is very similar to the error above. However when searching for the closest end node to the end point the system has an additional constraint in that the node must not only be walkable, it must also be able to be reached from the starting node. A common case when this error shows up is if the AI is say locked in a small room on one end of the map and gets an order to move to a point very far away. When trying to find a node close to the end point it will have to search a very large distance since only the nodes inside that small room are reachable from the starting node.

Ways to resolve this error:

  • See previous error.

There is no valid path to the target

This should not trigger unless you have supplied a custom NNConstraint on the path object that does not inherit from PathNNConstraint or that does not use the logic from the PathNNConstraint class.

Ways to resolve this error:

Searched whole area but could not find target

This means that there is no possible path from the start node to the end node. Usually this happens if you are using tags and are configuring them so that some tags cannot be traversed. With regular walkability, the system precalculates which nodes of the graph can be reached from which other nodes, however with tags it is not possible to do this.

This image shows the nodes that were searched when all tags could be traversed. Note that all nodes inside the red rectangle have a modified tag.

This image shows the nodes that were searched when the nodes inside the red rectangle could not be traversed due to their changed tag. Note that every single node that could be reached from the start node had to be traversed in order for the system to come to this conclusion.

No open points, the start node didn't open any nodes

This error is just a special case of the previous error. It is logged when only a single node was searched in the path and the end of the path could not be found. This particular error often happens due to a simple configuration error of grid graphs. If the AI has a collider and that collider is included in the Height Testing layer mask in the graph settings, then it may happen that the graph places a node on top of the AI's head (see image).

The result is that the AI thinks it is locked inside a very tiny room and cannot get out from there.

Ways to resolve this error:

  • Make sure that the AI is in a layer that is not included in the Height Testing layer mask.
See also
Pathfinding.GraphCollision.heightMask
https://docs.unity3d.com/Manual/Layers.html

Canceled path because a new one was requested

The Seeker component only handles a single path request at a time. Since path requests are asynchronous it may happen that a script tries to start to calculate a path before the previous path has been fully calculated. There are several times when this is reasonable, for example the agent might have teleported to another part of the map, then any previous path calculations would be pretty useless. In any case, when this happens the Seeker will cancel the previous path request and set this error message as the reason for it failing.

If you are seeing this message even when you are just trying to calculate paths normally it may be because your script is not properly waiting for the previous path to be calculated before starting a new path calculation. You can check if the Seeker is done calculating by calling the Seeker.IsDone method, or you could simply wait until the OnPathComplete callback is called.

Canceled by script (Seeker.CancelCurrentPathRequest)

This is very similar to the previous error message, but it means some script cancaled the path request using the Seeker.CancelCurrentPathRequest method. As the path was canceled explicitly by a script, one can reasonably assume that the script knows what it is doing, so you likely do not need to worry if you see this message.

There are no graphs in the scene

The AstarPath component does not contain any graphs at all. If you are loading graphs from a file or creating a graph using a script, it seems that some other script is trying to request a path before that has been done.

Graph errors

Some meshes were statically batched...

Some meshes were statically batched. These meshes can not be used for navmesh calculation due to technical constraints.
During runtime scripts cannot access the data of meshes which have been statically batched.
One way to solve this problem is to use cached startup (Save & Load tab in the inspector) to only calculate the graph when the game is not playing.

Unity's static batching system is great because it can combine multiple drawcalls into a single drawcall to improve the performance of your game. Unfortunately in doing this Unity also makes it impossible for this package's scripts to read the mesh data during runtime (except in the Unity editor). For recast graphs this means that those meshes cannot be used to generate a graph during runtime.

This image shows the toggle that Unity uses for static batching.

Ways to resolve this error:

  • You can use colliders instead of meshes to generate the recast graph (see recast graph settings). This is also usually faster since colliders are generally less detailed than meshes used for rendering.
  • You can calculate the graph in the editor and then just load it from a file when starting the game. This is very easy to do using the 'Cached Startup' feature that this package has. This also has the bonus of significantly improving your game's startup time since loading a graph from a file is much faster than generating it from scratch. The downside is that it does not work with procedural levels that are generated during runtime. Take a look at Saving and Loading Graphs for more info.
  • It is possible to statically batch geometry during runtime *after* the graph has been generated. Take a look at https://docs.unity3d.com/ScriptReference/StaticBatchingUtility.html.
  • You can of course also simply not use static batching.

Compiler errors

If the package did not install or upgrade correctly you may see some compiler errors. If you have just upgraded the package, the easiest way to make sure UnityPackages have not messed something up is to delete the AstarPathfindingProject folder (and the AstarPathfindingEditor folder too if you have it) and then import the package again.

Otherwise I recommend searching the forum for threads that mention similar errors.