Now that the basic syntax is no longer a mystery, let's get into the finer details of variable statements. Since we read code from left to right, it makes sense to begin our variable deep-dive with the keyword that traditionally comes first – an access modifier.
Take a quick look back at the variables we used in the preceding chapter in LearningCurve and you'll see they had an extra keyword at the front of their statements: public. This is the variable's access modifier. Think of it as a security setting, determining who and what can access the variable's information.
Any variable that isn't marked public is defaulted to private and won't show up in the Unity Inspector panel.
If you include a modifier, the updated syntax recipe we put together at the beginning of this chapter will look like this:
accessModifier dataType uniqueName = value;
While explicit access modifiers aren&apos...