In the first section, we will create the
waypoint script to place the waypoint for our AI movement direction, which can be edited in the editor. We will also learn how to use the
OnDrawGizmos() function, which we have used in Project 1, Creating a Sprite and Platform Game.
In this chapter, we will add the functions below the
OnDrawGizmos() function to show the visual for our waypoint.
We use the
Gizmos.DrawIcon() function to draw the icon image, see the direction line between two waypoints by using the
Line() function, to draw the line between two waypoints, and show the visual of the waypoint by using the
Gizmos.DrawWireSphere() function to draw the wire sphere at the position of the waypoint.