Every system, shown and explained
Features
Every system in NavMesh2D Pro, shown working in the editor and explained. For every detail, the package includes a complete user manual.
On this page · Profiles
01 · Profiles
Describe your characters once. Reuse everywhere.
Profiles separate how big a character is from how it moves. Agents point to shared profiles instead of each one storing every parameter, which keeps the scene tidy and processing fast. Any single agent can still override its settings.
Shape profiles
The physical size of a kind of character, mainly its radius. A rat and an ogre do not fit through the same gaps, so each size gets its own walkable map from the same bake.
Animation profiles
Speed, acceleration, turning speed, priority, refresh rate, whether the agent is confined to the mesh, and avoidance quality.
Per-agent overrides
Write agent.MaxSpeed = 6 and only that agent changes: it gets a private copy of its profile automatically.
03 · Pathfinding & queries
Not just "go there". The questions game AI actually asks.
Routes run over a polygonal decomposition of the mesh, not grid cells, and are pulled tight around corners so they look natural. On top of that, the API answers where to stand, where to run, where to hide and where to wander.
Flee & approach
Score nearby positions by distance, travel cost, direction and line of sight. Get the best few back, ranked.
Random destinations
A random point genuinely reachable on foot, or any walkable point in range, optionally one you can see.
Snap to the floor
Turn a mouse click or spawn marker into the nearest point a character can actually stand on.
Cost budgets
Cap the whole route cost ("only chase if close") or single steps ("never cross deep water").
Partial paths
If the goal is blocked, walk to the closest reachable point and wait, then carry on when the way opens.
Raycasts & nearby agents
How far can a body move in a straight line, and who is within a radius, accelerated by a spatial index.
var p = new NavMesh2D.DirectionalQueryParameters();
p.Mode = NavMesh2D.DirectionalQueryMode.Flee;
p.CostBudget = 30f;
p.LineOfSightWeight = 2f; // strongly prefer spots the threat cannot see
if (NavMesh2D.FindDirectionalDestination(agent.ShapeProfile, agent.CenterPosition,
threat.position, in p, out Vector2 hideAt))
{
agent.SetDestination(hideAt);
}
04 · Agents & movement
Characters that move like they mean it.
Agents don't just slide from A to B. Movement follows max speed, acceleration, turning speed and braking before tight corners, and every parameter can be changed at runtime until it feels right. The movement system is designed to be extremely efficient and highly customizable.
- Your physics, your animation. Drive a Rigidbody2D or let the agent move the Transform. Agent position is decoupled from the Transform, so navigation never fights your physics.
- Spawn anywhere. Agents placed in the editor or at runtime find the navmesh they belong to and start moving.
- Moving navmeshes. Platforms, ships and elevators: agents can ride along and attached links adapt automatically.
- Additive scenes. Load and unload scenes with navmeshes; links in one scene can even attach to navmeshes in another.
- Events. DestinationReached and PathFound tell you when to play the idle animation or open the door.
agent.SetDestination(target); // start walking
agent.ClearDestination(); // stop and forget the route
agent.SetPosition(spawnPoint); // teleport
agent.DestinationReached += OnArrived; // react to arrival
animator.SetFloat("Speed", agent.CurrentVelocity.magnitude);
05 · Crowd avoidance
Many characters. No traffic jams.
When two characters would collide, each one picks a velocity guaranteed not to lead to a collision in the next couple of seconds, in a way both sides agree on. They split naturally instead of mirroring each other's dodges.
| Quality | What runs | Use it for |
|---|---|---|
| Disabled | Nothing. Characters walk their route and ignore everyone. | Decorations, or when you handle collisions yourself. |
| Basic | Plain mutual avoidance against agents and obstacles. | Sparse scenes, or huge crowds where cost matters most. |
| Improved | Adds deadlock breaking and congestion braking. | The usual choice. |
| Extra | Adds a smarter split of who yields how much. | Dense crowds, cinematic quality. |
- Priorities: the boss holds a straight line, minions yield.
- Transparent agents: ghosts or the player can be ignored by others while still avoiding them.
- Line-of-sight filter: agents behind a thin wall don't react to each other.
- Hard separation: bodies never visually overlap, even in pile-ups.
- Avoidance presets: switch the whole crowd's tuning per scene with one call.
06 · Obstacles
Things that get in the way, and move around.
Two kinds of moving obstacle: ones that modify the geometry (carving) and ones that don't (non-carving). Both can apply to only some character sizes, and carving obstacles can block sight.
| Situation | Use |
|---|---|
| Static, blocks routes | Make it part of the navmesh as a collider or obstacle area |
| Moves rarely, can block routes | Carving obstacle · any shape, from colliders |
| Moves often or lives briefly | Non-carving obstacle · box or circle |
| Opens and closes a passage | Gate |
| Only makes an area costlier | Area cost modifier |
07 · Gates
Doors, drawbridges and checkpoints. No rebake.
A gate is a line placed between two walls. Close it and pathfinding treats the passage as impassable, characters physically stop at it and, optionally, vision is blocked. Block one direction, both, or only some characters.
navMesh.BlockGate(0, blockAtoB: true, blockBtoA: true); // close
navMesh.BlockGate(0, false, true); // one-way: enter, but not leave
navMesh.BlockGateSight(0, true); // frosted glass
// "Press E to open the door"
int door = navMesh.FindNearestGate(player.position, maxDistance: 1.5f);
08 · Area costs
Some ground is worth walking around.
Mark out areas that cost more to cross (mud, deep water, a street under sniper fire) and agents prefer to go around them, depending on how long the detour is. Areas can add walkable surface, or only re-price surface that already exists.
Overlaps combine
Where two tagged areas overlap, their multipliers combine into a higher cost.
Live repricing
Multipliers are not baked. Change one and every navmesh re-prices instantly.
Per-character limits
Tag water as expensive and give infantry a max step cost: they go around, amphibious units swim across.
09 · Links
Bridges between places that don't touch.
Links connect areas of one or more navmeshes and let agents cross under the conditions you choose: an area only reachable by jumping is only reached by agents that can jump. Once an endpoint is attached to a navmesh, it stays hooked to it.
public class JumpLinkAnimation : NavMesh2DAgentLinkAnimation
{
public override void OnEnteringMeshLink(NavMesh2DLinkAnimationData data)
{
StartCrossingMeshLink(data); // or CancelCrossingMeshLink(data)
}
public override void OnCrossingMeshLink(NavMesh2DLinkAnimationData data)
{
// move along an arc with data.Agent.SetPosition(...)
if (finished) OnMeshLinkCrossed(data); // hand control back
}
}
10 · Line of sight
Who can see whom, out of the box.
Navmeshes don't only do pathfinding. They include line-of-sight checks on a dedicated visibility mesh that adapts when geometry changes. Raycast between two points, check whether an agent is inside a vision cone, or get every agent in view.
Walls block
The navmesh edge is a wall: nothing outside is visible. Strict "indoor" sight.
Only obstacles block
The edge is transparent: spot agents on other navmeshes or mid-jump. The usual choice for guards and stealth.
Sight in crowds
Optionally, agents only avoid neighbours they can see, so a thin wall separates two crowds.
// Is the player inside this guard's 70° vision cone, within 12 units?
bool spotted = guard.CheckVisibilityInOpenSpace(12f, 70f, guard.HeadingDirection, player);
11 · Debugging & test tools
Always know what navigation is doing.
Check the result of the last bake: geometry complexity, the graph for each profile, the visibility mesh and more. Agent gizmos show movement direction, the computed path and the route taken over the last few seconds. Test components let you try every feature without code.
| Test component | What it exercises |
|---|---|
| Agent animation | Chase a target GameObject. The fastest way to see movement working. |
| Agent sight | Draws a sight cone and reports which agents are visible. |
| Flee / Approach | Runs the directional queries, draws the candidates, moves to the best. |
| Random / Sample position | Visualizes random and nearest-walkable-point queries. |
| Raycast | Visualizes body and sight raycasts from the agent. |
| Debug HUD | Live readout of speed, velocity, heading and avoidance settings. |
12 · Profiling
A built-in profiler, right in the Game view.
Enable it with one compilation define (ENABLE_NAVMESH2D_PROFILER) and it shows the cost of each navigation phase on screen, along with other useful information. Run it from time to time: a change in geometry or parameters can change performance a lot.
13 · Fine-tuning at runtime
Change everything. See it immediately.
Game designers will love working with NavMesh2D Pro. Change mesh shapes, agent parameters, area costs, link and gate positions, obstacle shapes, add agents or whole navmeshes, all in Play Mode, and watch the result in motion. Iterate fast to catch design mistakes, find performance tweaks, or hit exactly the behaviour you want.
- Works with domain reload off for near-instant Play Mode.
- Only what changed is recalculated, so tweaks show up right away.