From the course: Learning Unity 2D Scripting

Unlock the full course today

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

Data structures

Data structures - Unity Tutorial

From the course: Learning Unity 2D Scripting

Start my 1-month free trial

Data structures

- [Instructor] So far, we've looked at just a few different ways that we can edit scripts and add different properties that get exposed to the inspector. Let's take a look at a few other options so that we can better understand how to expose configuration options for our scripts to the inspector. We'll switch over to our HelloWorld script and scroll up to the top of our class. Right now, we have a new string for name, and we have a float for speed, both of which are showing up in the inspector. We can also create a public boolean and set this to a value alive. If we save this and go back into the editor, you'll now see in the inspector that a toggle switch is activated. Here you can turn on and off the alive value. We can also expose ints or other types of numbers, and if we set a default value, when we save our script and go back into Unity, that default value will automatically get populated in the inspector. Again, you can change this in the inspector to override the default value,…

Contents