Graph not generating within same scene

Hey!
Graphs are generating wonderfully upon loading new Scene, but, if I move the Player within the same scene, the graph does not generate. Any ideas?

  • Olafs

can you be a bit more clear about what you’re experiencing?

  • do you want the graph to change as the player moves during runtime?
  • is the player calculated into the graph as an obstacle and unwalkable part doesn’t follow the player as it moves?
  • are you trying to scan the graph again while running the game?

The last one - there is no changes in the graph per se, it just, after reloading the scene [the same one] doe not generate.
I checked out A* Pathfinding Project: Graph Updates during Runtime, but that polygon thing seebs to be made for 2D, no? I have a Recast Graph.
Image: it does generate, but after taking an elevator [green line] the scene reloads [and moves Player up], but there is no graph anymore.

image

Hi

When re-loading the scene, do you keep the previous AstarPath object around?

Yep. I have it local in each scene. It stays there.
In Play mode, if I hit Scan, it generate fine.
So, I guess, my question would be - how to properly trigger the scan. And from where? :slight_smile:

Not sure how your scene is set up. But if you want to trigger a scan during runtime, then you can call AstarPath.active.Scan() after the new scene is loaded.

Where do I that bit, man?

As the Scene is already loaded and then just takes the pause to move the Player to another location within same scene, so… technically it is not REloading…

Sorry about being dumb.

Note to myself, how easy it was.

Seriously thought it is more complicated.

Just in case, we can do it with delay.

I hope it’ll work everywhere…

image

1 Like