A* Pathfinding Project  4.2.0
The A* Pathfinding Project for Unity 3D
IWorkItemContext Interface Reference

Interface to expose a subset of the WorkItemProcessor functionality. More...

Detailed Description

Interface to expose a subset of the WorkItemProcessor functionality.

Public Member Functions

void EnsureValidFloodFill ()
 If a WorkItem needs to have a valid area information during execution, call this method to ensure there are no pending flood fills. More...
 
void QueueFloodFill ()
 Call during work items to queue a flood fill. More...
 
void SetGraphDirty (NavGraph graph)
 Trigger a graph modification event. More...
 

Member Function Documentation

◆ EnsureValidFloodFill()

void EnsureValidFloodFill ( )

If a WorkItem needs to have a valid area information during execution, call this method to ensure there are no pending flood fills.

If you are using the Pathfinding.GraphNode.Area property or the Pathfinding.PathUtilities.IsPathPossible method in your work items, then you might want to call this method before you use them to ensure that the data is up to date.

See also
Pathfinding.HierarchicalGraph
AstarPath.active.AddWorkItem(new AstarWorkItem((IWorkItemContext ctx) => {
ctx.EnsureValidFloodFill();
// The above call guarantees that this method has up to date information about the graph
if (PathUtilities.IsPathPossible(someNode, someOtherNode)) {
// Do something
}
}));

Implemented in WorkItemProcessor.

◆ QueueFloodFill()

void QueueFloodFill ( )

Call during work items to queue a flood fill.

An instant flood fill can be done via FloodFill() but this method can be used to batch several updates into one to increase performance. WorkItems which require a valid Flood Fill in their execution can call EnsureValidFloodFill to ensure that a flood fill is done if any earlier work items queued one.

Once a flood fill is queued it will be done after all WorkItems have been executed.

Deprecated:
Avoid using. This will force a full recalculation of the connected components. In most cases the HierarchicalGraph class takes care of things automatically behind the scenes now. In pretty much all cases you should be able to remove the call to this function.

Implemented in WorkItemProcessor.

◆ SetGraphDirty()

void SetGraphDirty ( NavGraph  graph)

Trigger a graph modification event.

This will cause a #Pathfinding.GraphModifier.PostUpdate event to be issued after all graph updates have finished. Some scripts listen for this event. For example off-mesh links listen to it and will recalculate which nodes they are connected to when it it sent. If a graph is dirtied multiple times, or even if multiple graphs are dirtied, the event will only be sent once.

Implemented in WorkItemProcessor.


The documentation for this interface was generated from the following file: