Recast graph scan tile

Is it possible to scan a selected tile? or a bound where all tiles inside/touching are scaned?

Hi
Sorry for the late answer.

Yes, you can just use a GraphUpdateObject with updatePhysics set to true and it will update all tiles it touches.

So something like
AstarPath.UpdateGraphs (new Bounds(...));
Should work I think.

It will even run the update in a separate thread.

No worries about. That is awesome!

When I did this I got the “CompareBaseObjectsInternal can only be called from the main thread.” like here: http://arongranberg.com/vanillaforums/discussion/1553/error-while-updating-graphs-graphupdateobject

Since I’m on a newer version I looked into fixing it.

changing GraphNode Constructor to use ReferenceEquals fixed it:
/** Constructor for a graph node. */ public GraphNode (AstarPath astar) { //this.nodeIndex = NextNodeIndex++; if(System.Object.ReferenceEquals(astar, null)) { throw new System.Exception("No active AstarPath object to bind to"); } else { this.nodeIndex = astar.GetNewNodeIndex(); astar.InitializeNode(this); } }

Hi

Yep, that fixes it.
I think that bug is fixed in the beta. At least it is fixed in my dev version.

Another thing. If you want to reduce the FPS impact of the scanning, you can do this change:
in AstarPath.Awake
if ( numThreads != 0 ) { graphUpdateThread = new Thread (new ParameterizedThreadStart(ProcessGraphUpdatesAsync)); graphUpdateThread.IsBackground = true; graphUpdateThread.Priority = System.Threading.ThreadPriority.Lowest; // Add this line graphUpdateThread.Start (this); }

That will make it run in a lower prioritised thread and thus take a bit longer, but will not impact FPS as much.