NavMeshes are typically static once they are baked. But in some cases, you want dynamic objects in the scene to update the NavMesh at runtime when they change their positions. The Nav Mesh Obstacle Component will allow you to do this. Let's start by creating a Cube with a new Material to serve as our dynamic Nav Mesh Obstacle. In the GameObject menu, navigate to 3D Object and select Cube. Rename the Cube to "DynamicBox." Next, create a new Material and name it "DynamicObstacle." Give it a color of your choice and assign this Material to the DynamicBox object. To give the box physics properties so the player can push it around the scene, you'll need to add a Rigidbody component to it. Select the DynamicBox cube in the Hierarchy, search for and select the Rigidbody component. In the Rigidbody component, reduce the Mass to make it more lightweight. You can run the game and test different Mass values until you find the one you like. Test the scene and notice that the Enemy goes straight through the DynamicBox. This is because the NavMesh is not aware of the obstacle yet. To make the NavMesh aware of the dynamic obstacle, select the DynamicBox cube, then search for and add the Nav Mesh Obstacle component. This component allows a moving obstacle to affect the NavMesh during the game. By default, the Nav Mesh Obstacle component will make the AI pathfind around the obstacle without carving a hole in the NavMesh around it. However, enabling the Carve option creates a larger hole in the NavMesh around the object, which ensures that the obstacle doesn't get too close and potentially cause the AI to get stuck. Enable the Carve option in the Nav Mesh Obstacle component. To create multiple instances of the dynamic obstacle, let's make the DynamicBox cube into a prefab. With the DynamicBox selected in the Hierarchy, drag it from the Hierarchy into the Prefabs folder in the Project window. This will create a prefab of the DynamicBox cube. Now you can duplicate and scatter the prefab instances around the play area as desired. You've successfully created dynamic obstacles that the AI knows how to avoid, and the player can interact with them during runtime. Next, let's update the winning and losing conditions to take the new game dynamics into consideration.