A* Pathfinding Project  4.1.7
The A* Pathfinding Project for Unity 3D
TileHandlerHelper Class Reference

Helper for navmesh cut objects. More...

Detailed Description

Helper for navmesh cut objects.

Adding an instance of this component into the scene makes sure that NavmeshCut components update the recast graph correctly when they move around.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here

Public Member Functions

void DiscardPending ()
 Discards all pending updates caused by moved or modified navmesh cuts. More...
 
void ForceUpdate ()
 Checks all NavmeshCut instances and updates graphs if needed. More...
 
void UseSpecifiedHandler (TileHandler newHandler)
 Use the specified handler, will create one at start if not called. More...
 

Public Attributes

float updateInterval
 How often to check if an update needs to be done (real seconds between checks). More...
 

Private Member Functions

void FindGraph ()
 
void HandleOnDisableCallback (NavmeshClipper obj)
 Called when a NavmeshCut or NavmeshAdd is disabled. More...
 
void HandleOnEnableCallback (NavmeshClipper obj)
 Called when a NavmeshCut or NavmeshAdd is enabled. More...
 
void OnDisable ()
 
void OnEnable ()
 
void OnRecalculatedTiles (NavmeshTile[] tiles)
 Called when some recast graph tiles have been completely recalculated. More...
 
void Start ()
 
void Update ()
 Update is called once per frame. More...
 

Private Attributes

readonly List< IntRectforcedReloadRects = new List<IntRect>()
 
TileHandler handler
 
float lastUpdateTime = float.NegativeInfinity
 

Additional Inherited Members

- Protected Member Functions inherited from VersionedMonoBehaviour
virtual void Awake ()
 
virtual int OnUpgradeSerializedData (int version, bool unityThread)
 Handle serialization backwards compatibility. More...
 

Member Function Documentation

◆ DiscardPending()

void DiscardPending ( )

Discards all pending updates caused by moved or modified navmesh cuts.

◆ FindGraph()

void FindGraph ( )
private

◆ ForceUpdate()

void ForceUpdate ( )

Checks all NavmeshCut instances and updates graphs if needed.

Note
This schedules updates for all necessary tiles to happen as soon as possible. The pathfinding threads will continue to calculate the paths that they were calculating when this function was called and then they will be paused and the graph updates will be carried out (this may be several frames into the future and the graph updates themselves may take several frames to complete). If you want to force all navmesh cutting to be completed in a single frame call this method and immediately after call AstarPath.FlushWorkItems.

◆ HandleOnDisableCallback()

void HandleOnDisableCallback ( NavmeshClipper  obj)
private

Called when a NavmeshCut or NavmeshAdd is disabled.

◆ HandleOnEnableCallback()

void HandleOnEnableCallback ( NavmeshClipper  obj)
private

Called when a NavmeshCut or NavmeshAdd is enabled.

◆ OnDisable()

void OnDisable ( )
private

◆ OnEnable()

void OnEnable ( )
private

◆ OnRecalculatedTiles()

void OnRecalculatedTiles ( NavmeshTile []  tiles)
private

Called when some recast graph tiles have been completely recalculated.

◆ Start()

void Start ( )
private

◆ Update()

void Update ( )
private

Update is called once per frame.

◆ UseSpecifiedHandler()

void UseSpecifiedHandler ( TileHandler  newHandler)

Use the specified handler, will create one at start if not called.

Member Data Documentation

◆ forcedReloadRects

readonly List<IntRect> forcedReloadRects = new List<IntRect>()
private

◆ handler

TileHandler handler
private

◆ lastUpdateTime

float lastUpdateTime = float.NegativeInfinity
private

◆ updateInterval

float updateInterval

How often to check if an update needs to be done (real seconds between checks).

For very large worlds with lots of NavmeshCut objects, it might be a performance penalty to do this check every frame. If you think this is a performance penalty, increase this number to check less often.

For almost all games, this can be kept at 0.

If negative, no updates will be done. They must be manually triggered using ForceUpdate


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