1. Home
  2. Docs
  3. NavTile
  4. Scripting
  5. NavTile Managers
  6. Surface Manager

Surface Manager

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

DataHolds all data of the NavTileGrid, see below for more details.
GridThe grid object that NavTile is using for its layout. This can be helpfull to convert world positions to coordinates.
GridInfoHolds almost the same data as the Grid, but it isn’t a Unity class allowing multithreaded operations.
NavTileMapsA list of all tilemaps NavTile is using.
BakeBakes 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.

TryAddTileAdds 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.
OverrideTileAdds 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.
RemoveTileRemoves a tile area on a position, leaving it blank and therefor unwalkable.
RefreshTileRefreshes the tile area at a position, looking at all present tiles at that position and taking the one with the highest priority.
GetTileDataGets 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.
IsTileWalkableChecks whether a tile at a position is walkable using an areamask which is a bit mask.
ClearTilesClears all tile data of the current scene.
SaveSaves the currently baked data to the scriptable object. This only works in the Unity Editor.
GridBoundsThe total bounds of the NavTileGrid, helpful if you need to loop over all tiles.
TileAmountThe 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.
HasNoTilesChecks if the data is empty in a lock-free operation.
TilesThe TileDictionary itself holding all the tile data.