
Every tab in the NavTile Settings Window has its own manager which can be accessed using the NavTileManager singleton. The NavTileManager is a scriptable object that is created automatically at Assets > Resources > NavTiles > NavTileManager. Through this singleton, general data and settings can be accessed and changed for each manager.
Surface Manager
By calling NavTileManager.Instance.SurfaceManager you can access all surface related data.
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.
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. |
LinkManager
By calling NavTileManager.Instance.LinkManager you can access all link related data.
GetAllPairs | Gets all NavLink pairs |
ContainsTileLink | Checks if the given tile is linked to a NavLink. |
GetLinkedTile | Gets the NavLink for a tile if present, otherwise, null. |
RemoveNavLink | Removes a NavLink for a specified tile if present. |
AddNavLink | Adds a new NavLink for a specified tile. |
GetLinkedAreaIndex | Gets the index of the area linked to the specified tile if present. |
RefreshAllNavLinks | This reinitializes all NavLinks using the resources folders, it will not find NavLinks outside these folders. |
AreaManager
By calling NavTileManager.Instance.AreaManager you can access all area related data.
GetAreaById | Returns the NavTileArea corresponding to that index. If the index is outside the bounds (0 – 31), it returns null. |
GetAreaIDByName | Gives the index of the area with the specified name if present, otherwise, -1 is returned. |
GetAreaByName | Returns the NavTileArea with the specified name if present, otherwise, null. |
IsDuplicateEntry | Checks if the specified area name is already present. |
InitializeDefaultNavTileAreas | Resets all NavTileAreas to the default. Use with caution as this will delete your areas. |