Correct way to use AstarPath.active.Scan()

I’ve just started looking at the A* Pathfinding Project, and i’m having trouble finding a solid way to use AstarPath.active.Scan().

I’m manually creating a graph for a procedural terrain, and it works perfectly when I click the scan button in editor; however calling AstarPath.active.Scan() seemingly doesn’t do anything. It shows a log for the scan in the console, however no visual of the graph appears in editor.

I am creating the graph inside AstarPath.active.AddWorkItem, and calling AstarPath.active.Scan() after. I understand I need to wait for the graph to be setup through the work item before calling scan, however other than some arbitrary ‘wait a few frames’ posts here on the forums, i’m not sure where the correct place is to call this.

Any help would be greatly appreciated.

Thanks

im having trouble with workitems myself, but if you call AstarPath.active.Scan(); without the workitem does it give you the graph?

I can’t use it within the WorkItem, but I can call it some time after and it works - I’d just like to know the correct usage (accurate and fastest usage), rather than just waiting for an arbitrary amount of time that seems to work

This got things working for me: Creating Grid Graph from scratch

1 Like