O'Reilly logo

Unity 3 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the waypoint and gizmos

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.

Prepare ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required