Let's register the Enemy prefab as a NavMeshAgent:
- Select the Enemy prefab, click Add Component in the Inspector window and search for NavMesh Agent. Make sure the Enemy prefab is in the scene is updated:
- Click Create | Create Empty from the Hierarchy window and name the GameObject Patrol Route.
- Select Patrol Route, click Create | Create Empty to add a child GameObject, and name it Location 1. Position Location 1 in one of the corners of the level:
- Create three more empty child objects in Patrol Route, name them Location 2, Location 3, and Location 4, respectively, and position them in the remaining corners of the level to form a square:
Adding a NavMeshAgent component to the Enemy tells the NavMesh component to take notice and register it as an object that has access to its autonomous navigation features. Creating the four empty game objects in...