Variables! — The building blocks of programming

Creating variables is easy. There are 4 attributes that need to be addressed when creating variables:

#1 Will the variable be public or private? Public variables are accessible from other classes while private variables are not. In Unity, public variables are also exposed for manual overriding in the inspector. Note that private variables can be exposed using [SerializeField]:

#2 What data type will the variable be:
Integer = whole number
Float = decimal number
Boolean = true or false (1 or 0)
String = alphanumeric

#3 What is the name of the variable. Note that private variables conventially begin with _… for easy recognition.

#4 What value will the variable start off with. Note that variables are not required to be assigned starting values.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Richard Morgan

Richard Morgan


Unity and Flutter developer interested in creating mixed-reality applications.