Bird
Raised Fist0
Unityframework~20 mins

NavMesh baking in Unity - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
NavMesh Baking Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
What is the output of this NavMesh baking status check?
Consider this Unity C# script snippet that checks the NavMesh baking status. What will be printed in the console?
Unity
using UnityEngine;
using UnityEngine.AI;

public class NavMeshStatusCheck : MonoBehaviour
{
    void Start()
    {
        var buildSettings = NavMesh.GetSettingsByID(0);
        Debug.Log($"Agent Type ID: {buildSettings.agentTypeID}");
        Debug.Log($"Voxel Size: {buildSettings.voxelSize}");
    }
}
AAgent Type ID: 1\nVoxel Size: 0.15
BAgent Type ID: 0\nVoxel Size: 0.3
CAgent Type ID: 1\nVoxel Size: 0.3
DAgent Type ID: 0\nVoxel Size: 0.15
Attempts:
2 left
💡 Hint
The default agent type ID for the first NavMesh agent is 0, and the default voxel size is 0.3.
🧠 Conceptual
intermediate
1:30remaining
Which component is essential for NavMesh baking in Unity scenes?
In Unity, to bake a NavMesh for AI navigation, which component must be present on the GameObjects that define walkable surfaces?
ANavMeshSurface
BNavMeshLink
CNavMeshObstacle
DNavMeshAgent
Attempts:
2 left
💡 Hint
This component defines the area where the NavMesh is generated.
🔧 Debug
advanced
2:30remaining
Why does this NavMesh baking code fail to update the NavMesh?
This Unity C# code attempts to bake a NavMesh at runtime but does not update the navigation mesh as expected. What is the cause?
Unity
using UnityEngine;
using UnityEngine.AI;

public class RuntimeNavMeshBake : MonoBehaviour
{
    public NavMeshSurface surface;

    void Start()
    {
        surface.BuildNavMeshAsync();
        Debug.Log("NavMesh baking started.");
    }
}
ANavMeshSurface requires Bake() instead of BuildNavMeshAsync() for runtime baking.
BBuildNavMeshAsync is deprecated and does not work at runtime.
CNavMeshSurface must be disabled before baking.
DBuildNavMeshAsync returns a JobHandle that must be completed to finish baking.
Attempts:
2 left
💡 Hint
Async baking returns a handle that controls job completion.
📝 Syntax
advanced
1:30remaining
Identify the syntax error in this NavMesh baking code snippet.
Which option contains the correct syntax to bake a NavMesh using NavMeshSurface in Unity?
Unity
public class BakeNavMeshExample : MonoBehaviour
{
    public NavMeshSurface surface;

    void Bake()
    {
        // Bake the NavMesh here
    }
}
Asurface.BuildNavMesh();
Bsurface.BuildNavMeshAsync();
Csurface.BakeNavMesh();
Dsurface.BuildNavMeshAsync
Attempts:
2 left
💡 Hint
Check the exact method name and usage.
🚀 Application
expert
3:00remaining
How many NavMesh areas are created after this baking setup?
You have a Unity scene with two NavMeshSurface components. One is set to include only the "Walkable" layer, and the other includes only the "Jump" layer. After baking both surfaces, how many distinct NavMesh areas will exist?
ANo NavMesh areas because layers cannot be baked separately
BOne combined NavMesh area including both layers
CTwo distinct NavMesh areas, one for each layer
DMultiple areas merged into a single NavMeshSurface automatically
Attempts:
2 left
💡 Hint
Each NavMeshSurface bakes its own area based on included layers.

Practice

(1/5)
1. What is the main purpose of NavMesh baking in Unity?
easy
A. To create a walkable map for characters to navigate
B. To add textures to 3D models
C. To animate characters automatically
D. To generate sound effects for the environment

Solution

  1. Step 1: Understand NavMesh baking concept

    NavMesh baking generates a navigation mesh that defines where characters can walk.
  2. Step 2: Identify the purpose from options

    Only To create a walkable map for characters to navigate describes creating a walkable map, which matches NavMesh baking.
  3. Final Answer:

    To create a walkable map for characters to navigate -> Option A
  4. Quick Check:

    NavMesh baking = walkable map creation [OK]
Hint: NavMesh baking = making paths for characters [OK]
Common Mistakes:
  • Confusing NavMesh baking with animation
  • Thinking it adds textures
  • Assuming it creates sounds
2. Which of the following is the correct way to start baking a NavMesh using the NavMeshSurface component in a script?
easy
A. navMeshSurface.Bake();
B. navMeshSurface.StartBake();
C. navMeshSurface.GenerateNavMesh();
D. navMeshSurface.CreateMesh();

Solution

  1. Step 1: Recall NavMeshSurface API method

    The official method to bake NavMesh in script is Bake().
  2. Step 2: Match method names with options

    Only navMeshSurface.Bake(); uses Bake(), others are incorrect or non-existent.
  3. Final Answer:

    navMeshSurface.Bake(); -> Option A
  4. Quick Check:

    NavMeshSurface baking method = Bake() [OK]
Hint: Use Bake() method to bake NavMesh in scripts [OK]
Common Mistakes:
  • Using non-existent methods like StartBake()
  • Confusing with GenerateNavMesh() or CreateMesh()
  • Forgetting to call Bake() after setup
3. Consider this code snippet in Unity:
using UnityEngine;
using UnityEngine.AI;

public class BakeNavMesh : MonoBehaviour {
    public NavMeshSurface surface;
    void Start() {
        surface.BuildNavMesh();
        Debug.Log("NavMesh baked");
    }
}
What will be the output when this script runs?
medium
A. NavMesh baked
B. Error: BuildNavMesh() does not exist
C. No output, script does nothing
D. NavMesh baking failed

Solution

  1. Step 1: Check NavMeshSurface API

    NavMeshSurface does not have BuildNavMesh(); the correct method is Bake(). This causes a compilation error.
  2. Step 2: Analyze execution

    The invalid method call prevents compilation, so no Debug.Log executes and an error occurs.
  3. Final Answer:

    Error: BuildNavMesh() does not exist -> Option B
  4. Quick Check:

    NavMeshSurface.Bake() exists, BuildNavMesh() does not [OK]
Hint: NavMeshSurface uses Bake(), not BuildNavMesh() [OK]
Common Mistakes:
  • Thinking BuildNavMesh() is valid
  • Expecting 'NavMesh baked' log output
  • Confusing BuildNavMesh() with Bake()
4. You wrote this code to bake a NavMesh but it does not work:
public NavMeshSurface surface;
void Start() {
    surface.BakeNavMesh();
}
What is the error and how to fix it?
medium
A. NavMeshSurface cannot bake at runtime
B. NavMeshSurface must be initialized with new keyword
C. Method name is wrong; use surface.Bake() instead
D. BakeNavMesh() needs parameters to work

Solution

  1. Step 1: Identify incorrect method call

    NavMeshSurface does not have BakeNavMesh() method; correct is Bake().
  2. Step 2: Correct method usage

    Replace surface.BakeNavMesh() with surface.Bake() to bake NavMesh properly.
  3. Final Answer:

    Method name is wrong; use surface.Bake() instead -> Option C
  4. Quick Check:

    Correct method = Bake() [OK]
Hint: Use Bake(), not BakeNavMesh(), to bake NavMesh [OK]
Common Mistakes:
  • Calling non-existent BakeNavMesh() method
  • Trying to create NavMeshSurface with new keyword
  • Assuming Bake needs parameters
5. You want to bake a NavMesh only on specific layers to optimize performance. Which approach should you use in Unity?
hard
A. Bake the entire scene and disable obstacles on unwanted layers
B. Manually delete unwanted NavMesh areas after baking
C. Use a separate NavMeshSurface for each layer but bake all layers together
D. Set the NavMeshSurface's LayerMask to include only desired layers before baking

Solution

  1. Step 1: Understand LayerMask usage in NavMeshSurface

    NavMeshSurface has a LayerMask property to select which layers to include in baking.
  2. Step 2: Choose the best optimization method

    Setting LayerMask before baking limits NavMesh to needed layers, improving performance.
  3. Final Answer:

    Set the NavMeshSurface's LayerMask to include only desired layers before baking -> Option D
  4. Quick Check:

    LayerMask filters layers during baking [OK]
Hint: Use LayerMask on NavMeshSurface to bake specific layers [OK]
Common Mistakes:
  • Deleting NavMesh areas manually after baking
  • Baking whole scene without filtering layers
  • Using multiple surfaces but baking all layers at once
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard