API reference
API reference
Select your platform
No SDKs available
No versions available

SceneNavigation Class

Extends MonoBehaviour
Manages the creation and updating of a navigation mesh (NavMesh) for scene navigation.
This class handles dynamic NavMesh generation based on scene data, including rooms and anchors, and responds to changes in the scene.

Fields

MRUK.RoomFilter BuildOnSceneLoaded[Get]
NavMeshCollectGeometry CollectGeometry[Get]
CollectObjects CollectObjects[Get]
float AgentRadius[Get]
float AgentHeight[Get]
float AgentClimb[Get]
float AgentMaxSlope[Get]
List< NavMeshAgent > Agents[Get]
MRUKAnchor.SceneLabels NavigableSurfaces[Get]
MRUKAnchor.SceneLabels SceneObstacles[Get]
LayerMask Layers[Get]
int AgentIndex[Get]
bool UseSceneData[Get]
bool CustomAgent[Get]
bool OverrideVoxelSize[Get]
float VoxelSize[Get]
bool OverrideTileSize[Get]
int TileSize[Get]

Properties

Event triggered when the navigation mesh has been initialized.
Gets a dictionary mapping MRUKAnchor objects to their corresponding GameObjects that represent obstacles in the environment.
Gets a dictionary mapping MRUKAnchor objects to their corresponding GameObjects that represent surfaces in the environment.
Transform ObstacleRoot[Get]

Member Functions

Toggles the use of global mesh for navigation.
Parameters
useGlobalMesh
Whether to use the global mesh to build the NavMesh
agentTypeID
The agent type ID to use for creating the scene nav mesh, if not specified, a new agent will be created.
Creates a navigation mesh for the entire scene.
Creates a navigation mesh for the scene.
This method creates a navigation mesh by collecting geometry from the scene, building the navigation mesh data, and adding it to the NavMesh. Currently, Unity does not allow the creation of custom NavMeshAgents at runtime. It also assigns the created navigation mesh to all NavMeshAgents in the scene.
Parameters
room
Optional parameter for the MRUKRoom to create the NavMesh for. If not provided, obstacles will be created for all rooms.
Creates a new NavMeshBuildSettings object with the specified agent properties.
Parameters
agentRadius
The minimum distance to the walls where the navigation mesh can exist.
agentHeight
How much vertical clearance space must exist.
agentMaxSlope
Maximum slope the agent can walk up.
agentClimb
The height of discontinuities in the level the agent can climb over (i.e. steps and stairs).
Returns
A new NavMeshBuildSettings object with the specified agent properties.
Creates a NavMeshSurface component and sets its properties.
Removes the NavMeshData from the NavMeshSurface component.
Resizes the NavMeshSurface to fit the room bounds.
Parameters
surface
The NavMeshSurface to resize.
room
The room bounds to use. Default is the current room.
Returns
The bounds of the resized NavMeshSurface.
Resizes the NavMeshSurface to fit the room bounds.
Parameters
surface
The NavMeshSurface to resize.
rooms
The rooms bounds to use.
Returns
The bounds of the resized NavMeshSurface.
Creates obstacles for the given MRUKRoom or all rooms if no room is specified.
Parameters
room
Optional parameter for the MRUKRoom to create the obstacles for. If not provided, obstacles will be created for all rooms.
Creates obstacles for the given MRUKRoom or all rooms if no room is specified.
Parameters
rooms
The rooms for which obstacles will be created.
Creates a NavMeshObstacle for the given MRUKAnchor.
Parameters
anchor
The MRUKAnchor to create the obstacle for.
shouldCarve
Optional parameter that determines whether the obstacle should carve the NavMesh. Default is true.
carveOnlyStationary
Optional parameter that determines whether the obstacle should only carve the NavMesh when stationary. Default is true.
carvingTimeToStationary
Optional parameter that sets the time in seconds an obstacle must be stationary before it starts carving the NavMesh. Default is 0.2f.
carvingMoveThreshold
Optional parameter that sets the minimum world space distance the obstacle must move before it is considered moving. Default is 0.2f.
Creating surfaces will not automatically build a new NavMesh. When changing surfaces at run time, always use BuildSceneNavMesh method
Parameters
room
Optional parameter for the MRUKRoom to create the navigable surfaces for. If not provided, navigable surfaces will be created for all rooms.
Clears all obstacles from the Obstacles dictionary associated with the given MRUKRoom.
If no room is specified, all obstacles are cleared.
Parameters
room
Optional parameter for the MRUKRoom to clear the obstacles for. If not provided, all obstacles will be cleared.
Clears the obstacle associated with the given MRUKAnchor from the Obstacles dictionary.
Parameters
anchor
The MRUKAnchor whose associated obstacle should be cleared.
Clears the surface associated with the given MRUKAnchor from the Obstacles dictionary.
Parameters
anchor
The MRUKAnchor whose associated obstacle should be cleared.

Static Member Functions

Gets the first layer included in the given LayerMask.
Parameters
layerMask
The LayerMask to get the first layer from.
Returns
Returns the first layer included in the LayerMask.
Validates the provided NavMeshBuildSettings against the provided NavMeshBounds.
Parameters
navMeshBuildSettings
The NavMeshBuildSettings to validate.
navMeshBounds
The Bounds to validate the NavMeshBuildSettings against.
Returns
Returns true if the NavMeshBuildSettings are valid, false otherwise.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon