
上QQ阅读APP看书,第一时间看更新
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.