Support Forum

"The Grid Graph is not scanned, cannot update area" warning--not generating the grid graph when Scan() was called in script

Only sometimes, I get a warning message which destroys my game’s playability. The warning message is following:

The Grid Graph is not scanned, cannot update area
UnityEngine.Debug:LogWarning (object)
Pathfinding.GridGraph:Pathfinding.IUpdatableGraph.UpdateArea (Pathfinding.GraphUpdateObject) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Generators/GridGenerator.cs:2996)
Pathfinding.GraphUpdateProcessor:ProcessRegularUpdates (bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/GraphUpdateProcessor.cs:277)
Pathfinding.GraphUpdateProcessor:ProcessGraphUpdates (Pathfinding.IWorkItemContext,bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/GraphUpdateProcessor.cs:193)
Pathfinding.WorkItemProcessor:ProcessWorkItems (bool,bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/WorkItemProcessor.cs:301)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForUpdate (bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/WorkItemProcessor.cs:381)
AstarPath:PerformBlockingActions (bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/AstarPath.cs:884)
AstarPath:Update () (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/AstarPath.cs:867)

and sometimes following:

The Grid Graph is not scanned, cannot update area
UnityEngine.Debug:LogWarning (object)
Pathfinding.GridGraph:Pathfinding.IUpdatableGraph.UpdateArea (Pathfinding.GraphUpdateObject) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Generators/GridGenerator.cs:2996)
Pathfinding.GraphUpdateProcessor:ProcessRegularUpdates (bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/GraphUpdateProcessor.cs:277)
Pathfinding.GraphUpdateProcessor:ProcessGraphUpdates (Pathfinding.IWorkItemContext,bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/GraphUpdateProcessor.cs:193)
Pathfinding.WorkItemProcessor:ProcessWorkItems (bool,bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/WorkItemProcessor.cs:301)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForScan (bool) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/Misc/WorkItemProcessor.cs:364)
AstarPath/<ScanInternal>d__144:MoveNext () (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/AstarPath.cs:1824)
AstarPath:Scan (Pathfinding.NavGraph[]) (at Library/PackageCache/com.arongranberg.astar@4.3.49/Core/AstarPath.cs:1660)
PathfinderAwakeScanner:FixedUpdate () (at Assets/Sunpeak Game/PathfinderAwakeScanner.cs:15)

Looks like that specific warning was discussed in the above thread. But I am not (1) using any GraphUpdateScene object in the scenes, (2) serializing/de-serializing the graph data, (3) having any parent-child game object mix-ups that were suggested as solutions in the above mentioned thread.

I’m just calling Astar.active.Scan() on Awake() on an independent monobehaviour that is in every scene I work with. For past several months, that worked flawlessly. Then, this warning started to happen and I can’t figure out how to make the graph graph scanned before the enemies spawn (which needs the graph to be scanned before they move).

I tried calling Astar.active.Scan() on Awake(), OnEnable(), Start(), IEnumerator wait 0.5 seconds, but none of that resulted in the grid graph being properly scanned. I tried changing script execution order of the monobehaviour before / after other Pathfinding items.

Only when I press the Scan button on Pathfinder in the inspector manually, it gets Scanned as expected. Is there any way to fix this issue?

Hi

Does it log any error when you scan it?
Have you verified that the above graph updates are performed after the graph is supposed to be scaanned?

It didn’t log any error when I manually press Scan on Pathfinder component. When I do see the error, it is only log warnings, not log error.

I reordered the script execution order so that the monobehaviour that calls Astar.active.Scan() to be the very first and the last. I also tried placing that monoBehaviour right before/after the Pathfinding components Execution Order that were already placed in there, just in case. Didn’t resolve the issue.

Also, any game object that uses Pathfinding logic is instantiated later in the game with a substantial delay after the scene loads. There’s an animation of player riding an elevator–and only after that animation ends, the level begins to build itself. Enemies, traps, and et cetera inside the trap are procedurally generated, while the tilemap which defines the level size are already in the scene.

Let’s say, for this instance, a graph update call was made on a scene where the grid graph wasn’t scanned. Maybe there’s a rogue piece of script that I couldn’t find for a week. And then Astar.active.Scan() was called. It seems to be implied that would cause the error of the graph not being scanned. It would be great if the first graph update call was just ignored, and then the Scan() would happen regardless of the case.

Is there any other way I should verify that the graph is being scanned before graph update calls?

Hi

Sorry for the late reply, I have been sick these last few weeks.

I’m still not sure what could cause this, unfortunately. Did you manage to gain any new insights?

You could also try the beta version which has had many bugfixes: A* Pathfinding Project

I was trying the latest beta version of A* pathfinding, as well as using the latest Unity version (2020.3.xx) as well.

Anyway, I wasn’t able to resolve it the way I wanted to. But caching the grid graph data seems remove that issue from happening. At first I thought it’d take too much effort to set up cache data for each individual levels, but having made an editor script to automate that process solved that issue of too-much work.

Maybe in the future if I found out what the exact cause of the issue is–or find out how to reproduce it exactly–I’ll make sure to make an update on that. Thanks,

1 Like