【Unreal Engine】NavMesh Setup and Optimization: Agent Settings to Runtime Generation

Created: 2025-12-12

NavMesh setup and optimization for AI character pathfinding. Covers NavMesh Bounds Volume placement, Agent Radius/Height adjustment, Runtime Generation selection criteria, and common troubleshooting.

Making AI characters move naturally and efficiently in-game is very important for enhancing game immersion. However, when setting up AI pathfinding in Unreal Engine, have you faced problems like "AI bumps into walls and won't move" or "performance degrades on large maps"?

Many of these problems stem from insufficient Navigation Mesh (NavMesh) setup and optimization in Unreal Engine. This article thoroughly explains everything from basic NavMesh setup to optimization techniques for maximizing performance, and practical AI movement control using Blueprint and C++, for Unreal Engine beginners to intermediate developers.


NavMesh Bounds Volume Setup

NavMesh is a data structure indicating areas where AI can move. In Unreal Engine, a special volume called NavMesh Bounds Volume is used to generate this NavMesh.

Placing NavMesh Bounds Volume

  1. Placement: Drag and drop NavMesh Bounds Volume from the Place Actors panel into the scene.
  2. Range Setting: Adjust the placed volume's size and position to cover all areas where AI will move.
  3. Verification: Press P key in the editor to display NavMesh-generated areas in green. Green areas are where AI can move.

💡 Common Mistake: If NavMesh Bounds Volume is too small or floating above the ground, NavMesh won't generate correctly. Verify that the volume's center is on the ground and completely encompasses the entire movement area.

Basic Adjustments in Project Settings

NavMesh generation precision and behavior can be adjusted in the Navigation Mesh section of Project Settings.

SettingDescriptionBest Practice
Cell SizeNavMesh grid size. Smaller = higher precision, but increased generation cost and memory.Usually default is sufficient. Reduce for fine movement needs. ※
Cell HeightNavMesh cell height.Default (25.0) is sufficient.
Agent RadiusAI character radius. Distance from walls and obstacles is calculated based on this radius.Match to AI character's Capsule Component radius.
Agent HeightAI character height.Match to AI character's Capsule Component height.
Agent Max SlopeMaximum slope angle (degrees) AI can climb.Default (44 degrees) is sufficient. Increase to climb steep slopes.
Agent Max Step HeightStep height AI can step over.Set considering character leg length. Default is 35.0.

※ Cell Size default value may vary by engine version. Please verify in your version.

Adjusting these settings to match AI character size is the most basic NavMesh optimization.

Troubleshooting When AI Can't Move

If AI can't move on NavMesh, check the following:

  • Agent Radius/Height: If smaller than character, it hits walls; if too large, can't pass through narrow passages.
  • Agent Max Slope: If unable to climb slopes, this value may be the cause.
  • Agent Max Step Height: If unable to climb steps, adjust this value.

NavMesh Optimization Techniques

In large maps or dynamic environments, NavMesh generation and updates can become performance bottlenecks. Optimize with the following settings.

Using Runtime Generation

The Runtime Generation setting in Project Settings > Navigation Mesh > Runtime category is one of the most impactful elements on performance.

Setting ValueDescriptionRecommended Situation
StaticBuild NavMesh once in editor, no runtime updates.Most static levels. Best performance.
Dynamic Modifiers OnlyAfter editor build, only reflects changes from Nav Mesh Modifier Volume, etc. at runtime.Limited dynamic elements like destructible objects or opening doors.
DynamicConstantly updates NavMesh at runtime.Completely dynamic environments (e.g., voxel-based games). Most expensive.

🚀 Optimization Hint: Choose Static or Dynamic Modifiers Only whenever possible. Dynamic is very expensive, so only consider using it when truly necessary.

Using Nav Mesh Modifier Volume

Use Nav Mesh Modifier Volume when you want to change NavMesh behavior only in specific areas.

  • Changing Area Class: Make specific regions impassable or assign different area classes to affect pathfinding.
  • Changing Cost: Locally increase pathfinding cost for specific ground (e.g., swamp) to make AI avoid it.

💡 About Dynamic NavMesh Updates

Nav Mesh Modifier Volume is mainly for modifying area attributes (cost, passability). To reflect new navigable areas like holes in destroyed walls in NavMesh, you need to set Runtime Generation to Dynamic or Dynamic Modifiers Only. Modifier Volume alone won't "add" new NavMesh regions.


AI Movement Control Implementation

Once NavMesh is correctly configured, next is actually moving AI characters.

AI Movement in Blueprint (AI MoveTo Node)

The simplest and most common method is using the AI MoveTo node.

// AI Controller Blueprint
// Event: Move to TargetLocation
Sequence
  -> AI MoveTo (Target Actor: None, Destination: TargetLocation, Target: Self)
    -> On Success (processing when movement completes)
    -> On Fail (processing when movement fails)

This node internally uses NavMesh to automatically calculate the optimal path and moves the AI character to the destination.

AI Movement in C++ (AAIController::MoveToLocation)

For more detailed control in C++, use the AAIController class's MoveToLocation function.

// MyAIController.cpp

#include "AIController.h"
#include "NavigationSystem.h"

void AMyAIController::MoveToTarget(const FVector& TargetLocation)
{
    // Check if NavMesh exists
    if (UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld()))
    {
        // Execute pathfinding and movement
        FAIMoveRequest MoveRequest;
        MoveRequest.SetGoalLocation(TargetLocation);
        MoveRequest.SetAcceptanceRadius(10.0f); // Tolerance for considering destination reached

        FNavPathSharedPtr NavPath;
        MoveTo(MoveRequest, &NavPath);
    }
}

Using C++ enables advanced customization like callback processing on movement success/failure, or dynamically changing paths during movement.


Smart AI Checklist

NavMesh setup and optimization directly affects both AI behavior and game performance.

  1. NavMesh Bounds Volume Verification: Does it cover the entire AI movement range? Did you verify the green area with P key?
  2. Agent Settings Adjustment: Did you adjust Project Settings to match AI character size (Radius/Height)?
  3. Runtime Generation Optimization: For static levels, did you select Static or Dynamic Modifiers Only to reduce unnecessary runtime costs?
  4. Movement Control Implementation: Are you correctly moving AI using Blueprint's AI MoveTo or C++'s AAIController::MoveTo?

Following these steps will enable your Unreal Engine project's AI characters to move smarter, smoother, and without compromising performance.