Support Forum

Grid graph not scanning on awake

… even when Scan on awake is enabled :sweat_smile: I’ve got to manually scan it in edit mode because the scan goes away when I exit play mode. Just a basic grid graph, no other custom code around graphs in the scene.

I’m using A* Pro v4.2.15. Any ideas?

Hi

Scan on awake scans the graphs when the game starts. In edit mode the graphs are unscanned unless you explicitly scan them (there’s a shortcut https://arongranberg.com/astar/docs/shortcuts.php) because it may take some time depending on the size of your graph.

Sure, that makes sense. What I’m saying is that Scan on awake is enabled and the graph isn’t scanning when I enter into play mode. The only way to make it work is to manually scan in edit mode before entering play mode, but as soon as I leave play mode it un-scans.

Also, I’m getting a low memory error every few times I enter into play mode—maybe it’s related? This is a test scene with like 5 small objects in it and very few scripts. The graph is a hexagon grid graph that is 40 x 40.

Potentially? Though a 40x40 graph is tiny, so it shouldn’t use a lot of memory.

Do the example scenes work for you?

The example scene kind of works? The pink is probably due to me using URP but that shouldn’t affect functionality. There’s an error on the initial load

It doesn’t scan the graph on play even though Scan on awake is enabled

And after manually scanning, the interactions with the purple pieces aren’t what they should be

Using A* Pro v4.2.15 and Unity 2021.1.9f1

Oh and @aron_granberg I meant to include this too: lots of objects are missing scripts. ex: all of the Colors and hexagon_obstacles

Hmm, if you have missing scripts it sounds like your package might not be imported correctly. You could try deleting the package and re-importing it.

@aron_granberg I just tried that last night and it still wasn’t working. Then I tried deleting the whole package and switching to the new beta and it’s still not working which mean’s it’s gotta be some setting in my project, right?

I also noticed, I’m not able to scan or re-scan graphs from my scripts while the game is in play mode — I’ve got to manually click the Scan button in the Pathfinding component which leads to things like DynamicGridBlocker not working at all. Pretty much my whole game is botched and I don’t know where to go from here. Unless you can think of something I guess I’ll just start a new project and see if this is still an issue then work on moving all my assets over.

I think I have the same issue. What happens for me is that the Grid Graph disappears after entering and exiting play mode in the editor, and manually selecting the A* object (that contains the pathfinder script) brings the graph back.

I think it is the graph because I tried to scan the graph in my code using AstarPath.active.Scan() but it gives the following error: There are no graphs in the scene. Even though there is one in the pathfinder script. I also tried saving it to the cache but that didn’t solve it.

Glad to know I’m not alone :grin:

I just created a brand new project using v4.2.15 and everything scans like it should. I just have no idea where to even begin checking to see why it won’t scan in my current project.

Hi

Hmm, maybe you have 'Reload Scene` disabled in your editor play mode options:
image

The A* Pathfinding Project only supports having reload domain disabled, but not reload scene. The beta version shows a big warning if it detects this, but the current release doesn’t have that warning yet.

1 Like

Ah, this was it for me. Thank you!

1 Like