Displaying public variables in the Inspector panel

I'm sure you're wondering what the word public means at the beginning of a variable statement:

public int number1 = 2;

It means that the variable will be visible and accessible. It will be visible as a property in the Inspector panel so that you can manipulate the value stored in the variable. It also means it can be accessed from other scripts using the Dot Syntax. You'll learn more about the Dot Syntax in Chapter 6, Using Dot Syntax for Object Communication.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.70.247