"The Grid Graph is not scanned, cannot update graph" warning after ugprading to 5+

Hello. I have finally upgraded from 5.1.4 from 4.2.15. Now whenever I go to another scene, I’m calling AstarPath.active.Scan() as I have just re-added objects to the scene, and I’m getting “The Grid Graph is not scanned, cannot update graph” warning:

The Grid Graph is not scanned, cannot update graph
UnityEngine.Debug:LogWarning (object)
Pathfinding.GridGraph:Pathfinding.IUpdatableGraph.ScheduleGraphUpdates (System.Collections.Generic.List`1<Pathfinding.GraphUpdateObject>) (at ./Packages/com.arongranberg.astar/Graphs/GridGraph.cs:2682)
Pathfinding.GraphUpdateProcessor:QueueGraphUpdatesInternal (Pathfinding.IWorkItemContext) (at ./Packages/com.arongranberg.astar/Core/Pathfinding/GraphUpdateProcessor.cs:149)
AstarPath/<>c__DisplayClass97_0:<QueueGraphUpdates>b__0 (Pathfinding.IWorkItemContext) (at ./Packages/com.arongranberg.astar/Core/AstarPath.cs:995)
Pathfinding.WorkItemProcessor:ProcessWorkItems (bool,bool) (at ./Packages/com.arongranberg.astar/Core/Misc/WorkItemProcessor.cs:323)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForScan (bool) (at ./Packages/com.arongranberg.astar/Core/Misc/WorkItemProcessor.cs:399)
AstarPath/<ScanInternal>d__127:MoveNext () (at ./Packages/com.arongranberg.astar/Core/AstarPath.cs:1670)
AstarPath:Scan (Pathfinding.NavGraph[]) (at ./Packages/com.arongranberg.astar/Core/AstarPath.cs:1573)
ItemPlanter:PlantObjects () (at Assets/Scripts/Persistence/ItemPlanter.cs:54)
ItemPlanter:Start () (at Assets/Scripts/Persistence/ItemPlanter.cs:25)

What could be the reason of this?

Thanks!

Hi

In version 5, the graphs are now scanned during OnEnable instead of during Awake. In this case, some of your scripts might be scheduling graph updates before the graphs are scanned.
When your ItemPlanter later calls AstarPath.Scan, it will process all pending work items before starting to scan the graphs, which logs those errors.

Check the upgrade guide: Upgrade Guide - A* Pathfinding Project

Thanks @aron_granberg for the prompt response. However, my script is running this in Start so it should not be triggering before the OnEnable, I checked the script order (which I’m assuming won’t matter) and I don’t see any issues. Both are freely enabled when the scene start so I’m not doing any on/off toggling.

Is there a way to debug this that you recommend to see if it’s the order of the callbacks (which part can I test from astar)?

Hi

Easiest is to log both in ItemPlaner.PlantObjects and wherever you your scripts that you call AstarPath.active.UpdateGraphs. The update graph calls should ideally happen after the PlantObjects call.

Ah perfect! I didn’t understand what you meant before, but now I do!

The issue occurs whenever I have an AstarPath.active.UpdateGraphs() called before the my own AstarPath.active.Scan() which causes these warnings. I reordered the scripts to make sure the ItemPlanter was being called earlier and it fixed the warning issue.

Thanks a lot!

1 Like