NullReferenceException while scanning point graph

Hello there to everyone!
My project works on Unity 2018.2.2f1 with AStar ver.
Recently I tried to update project to the newer Unity version 2020.3.5f1 and AStar with it to version 4.2.15.
Fixed some deprecated API calls in my project, all works seems to be fine except one thing: scanning PointGraph.
I scan all my graphs(there’re two GridGraphs and one PointPraph) iteratively while loading main game scene:

		for (int i = 0; i <; i++)

The error occurs in method AddConnection:

    (this.Graph as PointGraph).RegisterConnectionLength((node.position - position).sqrMagnitudeLong);

as operator returns null when method is called. Other rest scans of GridGraphs performs correctly.

Could you suggest any advice to solve this problem, please?


That’s odd. For that to happen something must be very wrong in the internal datastructures…

Does it work if you use the built-in method to scan all graphs instead of scanning them all individually?;

Hello, thanks for the answer!
Using method you’ve suggested causes same error when AStar tries to scan PointGraph.
Maybe I was upgraded AStar in a wrong way? I have just imported new version over old one.

I have checked script execution order, graphs settings and AStar settings. Then I tried to reimport project. Tried to delete old AStar then import a new one.
These steps didn’t help neither.

I didn’t find any working solution about this issue, and I had to stay on older version (

I’m sorry that you couldn’t find a solution.
I have no idea what is causing this. The best guess I have is that somehow the data upgrade from 3.8 went wrong and the graph metadata is corrupt in some way (even though I have unit tests for this they might not find everything). You could try re-creating the graphs from a blank slate and see if that works.