A* Pathfinding Project  4.3.8
The A* Pathfinding Project for Unity 3D
NavmeshUpdates Class Reference

Helper for navmesh cut objects. More...

Detailed Description

Helper for navmesh cut objects.

Responsible for keeping track of which navmesh cuts have moved and coordinating graph updates to account for those changes.

See also
Navmesh Cutting
AstarPath.navmeshUpdates
Pathfinding.NavmeshBase.enableNavmeshCutting

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

Classes

class  NavmeshUpdateSettings
 Stores navmesh cutting related data for a single graph. More...
 

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 ForceUpdateAround (NavmeshClipper clipper)
 

Public Attributes

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

Package Functions

void OnDisable ()
 
void OnEnable ()
 
void Update ()
 Update is called once per frame. More...
 

Private Member Functions

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...
 

Private Attributes

float lastUpdateTime = float.NegativeInfinity
 Last time navmesh cuts were applied. More...
 

Member Function Documentation

◆ DiscardPending()

void DiscardPending ( )

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

◆ 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.
// Schedule pending updates to be done as soon as the pathfinding threads
// are done with what they are currently doing.
// Block until the updates have finished

◆ ForceUpdateAround()

void ForceUpdateAround ( NavmeshClipper  clipper)

◆ 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 ( )
package

◆ OnEnable()

void OnEnable ( )
package

◆ Update()

void Update ( )
package

Update is called once per frame.

Member Data Documentation

◆ lastUpdateTime

float lastUpdateTime = float.NegativeInfinity
private

Last time navmesh cuts were applied.

◆ updateInterval

float updateInterval

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

For worlds with a very large number of NavmeshCut objects, it might be bad for performance 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.

// Check every frame (the default)
AstarPath.active.navmeshUpdates.updateInterval = 0;
// Check every 0.1 seconds
AstarPath.active.navmeshUpdates.updateInterval = 0.1f;
// Never check for changes
AstarPath.active.navmeshUpdates.updateInterval = -1;
// You will have to schedule updates manually using

You can also find this in the AstarPath inspector under Settings.


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