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 Gizmos.Draw
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.
First, we need to drag-and-drop the Gizmos folder, which is located outside the Chapter6 folder, as shown in the following screenshot:
Why did we move the folder outside the Chapter6
folder?
Take a look at this: http://unity3d.com/support...