From the course: Unity 5: 2D Level Design

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Create gizmos

Create gizmos - Unity Tutorial

From the course: Unity 5: 2D Level Design

Start my 1-month free trial

Create gizmos

- [Instructor] At this point we now have a switch that can activate the door, but it's really hard to see that the two of them are connected. We're going to add something called a gizmo. A gizmo allows us to draw elements inside of the scene view that won't show up during the game. This is helpful to let us see elements and interactivity within our own tools in our level. Let's go to the JetroidLevelDesign folder. Open up the scripts folder and let's open up the Switch class inside of MonoDevelop. At the bottom of the class, we're going to create a new method. This will be void and we're going to call this OnDrawGizmos. This will automatically get called when we're inside of the editor. The first thing we're going to do is set the gizmo's color. We'll work directly by setting the Gizmos.color value to either red or green. In order to determine which color we want to use, let's take a look at the sticky value. If sticky is true, we want to set the color to red. If it's false, we want…

Contents