Class RecastTileUpdateHandler Extends MonoBehaviour
Helper for easier fast updates to recast graphs.
When updating recast graphs, you might just have plonked down a few GraphUpdateScene objects or issued a few GraphUpdateObjects to the system. This works fine if you are only issuing a few but the problem is that they don't have any coordination in between themselves. So if you have 10 GraphUpdateScene objects in one tile, they will all update that tile (10 times in total) instead of just updating it once which is all that is required (meaning it will be 10 times slower than just updating one tile). This script exists to help with updating only the tiles that need updating and only updating them once instead of multiple times.
It is coupled with the RecastTileUpdate component, which works a bit like the GraphUpdateScene component, just with fewer options. You can attach the RecastTileUpdate to any GameObject to have it schedule an update for the tile(s) that contain the GameObject. E.g if you are creating a new building somewhere, you can attach the RecastTileUpdate component to it to make it update the graph when it is instantiated.
If a single tile contains multiple RecastTileUpdate components and many try to update the graph at the same time, only one tile update will be done, which greatly improves performance.
If you have objects that are instantiated at roughly the same time but not exactly the same frame, you can use the maxThrottlingDelay field. It will delay updates up to that number of seconds to allow more updates to be batched together.
You should only have one instance of this script in the scene if you only have a single recast graph. If you have more than one graph you can have more than one instance of this script but you need to manually call the SetGraph method to configure it with the correct graph.
This does not use navmesh cutting. If you only ever add obstacles, but never add any new walkable surfaces then you might want to use navmesh cutting instead. See Navmesh Cutting.
Since version 5.0, this component is not necessary, since normal graph updates on recast graphs are now batched together if they update the same tiles. Use e.g. the DynamicObstacle component instead.
Public Methods
Public Variables
All tile updates will be performed within (roughly) this number of seconds.
Private/Protected Members
True if any elements in dirtyTiles are true.
True for a tile if it needs updating.
Earliest update request we are handling right now.
Graph that handles the updates.