A* Pathfinding Project  4.1.20
The A* Pathfinding Project for Unity 3D
AstarWorkItem Struct Reference

An item of work that can be executed when graphs are safe to update. More...

Detailed Description

An item of work that can be executed when graphs are safe to update.

See also
AstarPath.UpdateGraphs
AstarPath.AddWorkItem

Public Member Functions

 AstarWorkItem (System.Func< bool, bool > update)
 
 AstarWorkItem (System.Func< IWorkItemContext, bool, bool > update)
 
 AstarWorkItem (System.Action init, System.Func< bool, bool > update=null)
 
 AstarWorkItem (System.Action< IWorkItemContext > init, System.Func< IWorkItemContext, bool, bool > update=null)
 

Public Attributes

System.Action init
 Init function. More...
 
System.Action< IWorkItemContextinitWithContext
 Init function. More...
 
System.Func< bool, bool > update
 Update function, called once per frame when the work item executes. More...
 
System.Func< IWorkItemContext, bool, bool > updateWithContext
 Update function, called once per frame when the work item executes. More...
 

Constructor & Destructor Documentation

◆ AstarWorkItem() [1/4]

AstarWorkItem ( System.Func< bool, bool >  update)

◆ AstarWorkItem() [2/4]

AstarWorkItem ( System.Func< IWorkItemContext, bool, bool >  update)

◆ AstarWorkItem() [3/4]

AstarWorkItem ( System.Action  init,
System.Func< bool, bool >  update = null 
)

◆ AstarWorkItem() [4/4]

AstarWorkItem ( System.Action< IWorkItemContext init,
System.Func< IWorkItemContext, bool, bool >  update = null 
)

Member Data Documentation

◆ init

System.Action init

Init function.

May be null if no initialization is needed. Will be called once, right before the first call to update.

◆ initWithContext

System.Action<IWorkItemContext> initWithContext

Init function.

May be null if no initialization is needed. Will be called once, right before the first call to update.

A context object is sent as a parameter. This can be used to for example queue a flood fill that will be executed either when a work item calls EnsureValidFloodFill or all work items have been completed. If multiple work items are updating nodes so that they need a flood fill afterwards, using the QueueFloodFill method is preferred since then only a single flood fill needs to be performed for all of the work items instead of one per work item.

◆ update

System.Func<bool, bool> update

Update function, called once per frame when the work item executes.

Takes a param force. If that is true, the work item should try to complete the whole item in one go instead of spreading it out over multiple frames.

Returns
True when the work item is completed.

◆ updateWithContext

System.Func<IWorkItemContext, bool, bool> updateWithContext

Update function, called once per frame when the work item executes.

Takes a param force. If that is true, the work item should try to complete the whole item in one go instead of spreading it out over multiple frames.

Returns
True when the work item is completed.

A context object is sent as a parameter. This can be used to for example queue a flood fill that will be executed either when a work item calls EnsureValidFloodFill or all work items have been completed. If multiple work items are updating nodes so that they need a flood fill afterwards, using the QueueFloodFill method is preferred since then only a single flood fill needs to be performed for all of the work items instead of one per work item.


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