Skip to content

Surface Manager

By calling NavTileManager.Instance.SurfaceManager you can access all surface related data.

Member Description
Data Holds all data of the NavTileGrid, see below for more details.
Grid The grid object that NavTile is using for its layout. This can be helpfull to convert world positions to coordinates.
GridInfo Holds almost the same data as the Grid, but it isn't a Unity class allowing multithreaded operations.
NavTileMaps A list of all tilemaps NavTile is using.
Bake Bakes the current scene using a specified pathfinding algorithm.

Data

The data reference in the SurfaceManager holds all the tile data (e.g. which tiles are walkable and which aren't). Accessing this allows you to get info or dynamically change tiles. This data is stored in a scriptable object inside a resources folder next to its corresponding scene.

Member Description
TryAddTile Adds a tile area at a position using the index of an area, this index can be retrieved using the AreaManager. Adding the tile fails if the already present area has a higher priority than the new tile area.
OverrideTile Adds a tile area at a position using the index of an area, this index can be retrieved using the AreaManager. This method ignores area priority and overrides any present tile area.
RemoveTile Removes a tile area on a position, leaving it blank and therefor unwalkable.
RefreshTile Refreshes the tile area at a position, looking at all present tiles at that position and taking the one with the highest priority.
GetTileData Gets the TileData at a position. The data holds the area linked to the tile and possible obstructing agents. If the tile is not present on the NavTileGrid, it will return null.
IsTileWalkable Checks whether a tile at a position is walkable using an areamask which is a bit mask.
ClearTiles Clears all tile data of the current scene.
Save Saves the currently baked data to the scriptable object. This only works in the Unity Editor.
GridBounds The total bounds of the NavTileGrid, helpful if you need to loop over all tiles.
TileAmount The total amount of tiles in the dictionary.
Note: This is a O(N) operation to keep it lock-free. Calling it too often might lead into performance issues.
HasNoTiles Checks if the data is empty in a lock-free operation.
Tiles The TileDictionary itself holding all the tile data.