Issues with adding NodeLinks to a custom graph

Howdy,

Long story short, the project involves 3D movement on non-euclidean geometry, stuff like tiny planets with significant geographical features. The first iteration of pathfinding involved a Navmesh Graph and a collection of object pairs + NodeLink2 automatically generated by my jump mesh system, so far so good, however, since GraphUpdateScene isn’t non-euclidean friendly and I need tagged areas, I proceded to write a custom graph generator (WIP) that converted a custom Navmesh into a Point Graph with custom connections, that part works as intended, but when I try to incorporate the NodeLinks something isn’t working.

On the first scan I get these error logs:

There was an error generating the graphs:
System.NullReferenceException: Object reference not set to an instance of an object
  at Pathfinding.PointNode.AddConnection (Pathfinding.GraphNode node, System.UInt32 cost) [0x000b1] in –/Assets/AstarPathfindingProject/Generators/NodeClasses/PointNode.cs:142 
  at Pathfinding.NodeLink2.Apply (System.Boolean forceNewCheck) [0x000a8] in –/Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:196 
  at Pathfinding.NodeLink2.InternalOnPostScan () [0x0016a] in –/Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:112 
  at Pathfinding.NodeLink2.OnPostScan () [0x00000] in –/Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:72 
  at Pathfinding.GraphModifier.TriggerEvent (Pathfinding.GraphModifier+EventType type) [0x00058] in –/Assets/AstarPathfindingProject/Core/Misc/GraphModifier.cs:71 
  at AstarPath+<ScanAsync>d__141.MoveNext () [0x002e6] in –/Assets/AstarPathfindingProject/Core/AstarPath.cs:1755 
  at Pathfinding.AstarPathEditor.MenuScan () [0x000bc] in –/Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1442 
If you think this is a bug, please contact me on forum.arongranberg.com (post a new thread)

And of course the accompanying " NullReferenceException: Object reference not set to an instance of an object "

If I try to scan again, even if I remove the graphs or disable the jump mesh objects I get:

There was an error generating the graphs:
System.InvalidOperationException: Another async scan is already running
  at AstarPath+<ScanAsync>d__141.MoveNext () [0x003f8] in –/Assets/AstarPathfindingProject/Core/AstarPath.cs:1791 
  at Pathfinding.AstarPathEditor.MenuScan () [0x000bc] in –/Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:1442 
If you think this is a bug, please contact me on forum.arongranberg.com (post a new thread)

and

InvalidOperationException: Another async scan is already running

Then the Pathfinder component becomes useless, I’ll get the second errors even if I remove the graph used for node links and disable the objects, I need to remove the Pathfinder component and add a new one to be able to perform a scan again.

I can avoid these errors and apparently make a successful scan if I change the inheritance of my custom generator from NavGraph to PointGraph, the gizmos look fine and the connections are correct but then AstarPath is unable to find the closest node and generate a path:

Path Failed : Computation Time 0.00 ms Searched Nodes 0
Error: Couldnt find a node close to the start point
Path Number 7 (unique id)
UnityEngine.Debug:LogWarning (object)
AstarPath:LogPathResults (Pathfinding.Path) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:835)
AstarPath:<InitializePathProcessor>b__122_1 (Pathfinding.Path) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1301)
Pathfinding.PathProcessor:CalculatePathsThreaded (Pathfinding.PathHandler) (at Assets/AstarPathfindingProject/Core/Misc/PathProcessor.cs:379)
Pathfinding.PathProcessor/<>c__DisplayClass24_0:<.ctor>b__0 () (at Assets/AstarPathfindingProject/Core/Misc/PathProcessor.cs:110)
System.Threading.ThreadHelper:ThreadStart ()

Please help me get out of this either/or pathfinding mess.

Hi

The NodeLink2 component tries to insert point nodes to serve as the start and end points of the off-mesh-link. If you have a custom graph generator inheriting from a point graph, this might be problematic?

My graph generator inherits from NavGraph, the PointGraph thing seemed very time consuming indeed. In the end I couldn’t get NodeLink/NodeLink2 to scan without errors so I just added the jump connection algorithm in the graph generator and voila, I don’t have to worry about NodeLink components anymore!

1 Like