Creating Modular Waypoint System in Unity (part 1)

Objective: setup the player and the game objects.

First I created a new c# script for the guard AI.

Then we have to add the nav mesh component to the guards.

Within the script we have to create a List of Transform to store the different waypoints for the guard movement.

Then we have to set the waypoint quantity for the guard in the inspector.

In order to get the different positions I duplicated the guard and distributed the objects to create the guard path. After setting the position we have to remove all the components of the duplicated objects but the Transform.

In this case I created a waypoints game object and set all the positions as a child of this object.

And that’s it!!! We have everything ready to start to write the code for the movement.