CodeBlanks Logo Icon CodeBlanks

The NavMesh concept

Learn that the NavMesh defines walkable surfaces.

NavMesh (Navigation Mesh) Concept

A NavMesh (navigation mesh) is a geometric surface representation defining where AI characters can traverse and which obstacles they must avoid in the 3D world.

// Static scene geometry is included in the NavMesh calculation
// Walkable areas are displayed in the editor as a cyan mesh overlay

After tagging terrain and barriers as 'Navigation Static', the 'Bake' process automatically calculates the traversable (Walkable) topology.

NavMesh Layers and Area Costs

NavMesh surfaces can be segmented into distinct layers: Walkable (standard ground), Not Walkable (impassable barriers), and Jump (chasm gaps). Each area type carries an associated Area Cost.

using UnityEngine.AI;

// AI pathfinding prioritizes the shortest and least costly path

The pathfinding algorithm (A*) may favor longer, clear paths over shorter routes through high-cost mud or hazardous zones.

Practice NavMesh status check

Define a Start method. Inside, declare string durum = "NavMesh yuzeyi hazir"; and print it to the console with Debug.Log(durum);.

Starter code

Player.cs
using UnityEngine;

public class NavMeshInfo : MonoBehaviour
{
    // Start icinde durum degiskenini tanimla ve yazdir
}

Sample solution

Player.cs
using UnityEngine;

public class NavMeshInfo : MonoBehaviour
{
    void Start()
    {
        string durum = "NavMesh yuzeyi hazir";
        Debug.Log(durum);
    }
}

Expected output

NavMesh yuzeyi hazir

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which property must be enabled on scene objects for them to be included in the NavMesh Bake calculation?

  • Is Trigger
  • Shader Graph Alpha
  • AudioSource Mute
  • Navigation Static Correct answer

Explanation: During NavMesh baking, only stationary objects flagged as 'Navigation Static' are evaluated as walkable surfaces or obstacles.

2 Import navigation namespace

Question
using UnityEngine.____;
Answer
using UnityEngine.AI;

Explanation: To access NavMesh and navigation classes in Unity, the 'UnityEngine.AI' namespace is imported.

3 NavMesh core concepts

Term Meaning
NavMesh Navigation mesh for walkable areas
Bake Generating NavMesh from geometry
Walkable Free surface where characters can walk
Area Cost Cost multiplier of a NavMesh area

All lessons in Advanced