Tools for working with Unity's NavMeshComponents and generating navmesh: link generation, mesh cleanup, etc
Default NavMesh Generation | Using NavLinkGenerator's Bake Links and Interior Volumes |
---|---|
NavLinkGenerator is an asset for generating NavMeshLinks across gaps in your navmesh. It also serves as the central hub for navgen.
NavLinkGenerator is a ScriptableObject -- so you need to create one to start using it (Assets > Create > Navigation > NavLinkGenerator). The asset contains settings and buttons for generating links.
The "Create Interior Volumes" button in NavLinkGenerator creates a NavNonWalkableCollection which tracks the volumes so they can be rebuilt. Remove a volume from this component's list to prevent it from being modified.
You can assign enum values from UnityEngine.AI.NavMeshAreas
to NavMeshAgent's
AreaMask and UnityEngine.AI.NavMeshAreaIndex
to area indexes in
NavMeshSurface, NavMeshLink, NavMeshModifierVolume, etc. These enums are
automatically updated from the areas defined in Navigation (Window > AI >
Navigation).
NavMeshAreas generates two enums that look something like this:
// NavMeshAgent uses AreaMask.
[Flags]
public enum NavMeshAreas
{
None = 0,
Walkable = 1, NotWalkable = 2, Jump = 4, Climb = 8, Blocked = 16, Hole = 32, Edge = 64, Fall = 128, New1 = 256, Stuff = 512,
All = ~0,
}
// NavMeshSurface, NavMeshLink, NavMeshModifierVolume, etc. use indexes.
public enum NavMeshAreaIndex
{
Walkable = 0, NotWalkable = 1, Jump = 2, Climb = 3, Blocked = 4, Hole = 5, Edge = 6, Fall = 7, New1 = 8, Stuff = 9,
}
See the example branch for a demonstration project.
-
Install Unity NavMeshComponents from github.
-
Copy the code to your project or add a dependency to your manifest.json to install as a package:
"com.github.idbrii.unity-navgen": "https://github.com/idbrii/unity-navgen.git#latest-release",
- NavMeshLinks_AutoPlacer by eDmitriy
- Navmesh Cleaner (see here to use with NavMeshComponents)
This project includes UnityNavMeshAreas Copyright (c) 2018 jeffvella.