Variables
Learn about variables and how they are used to store and manipulate data of different data types throughout the code.
We'll cover the following...
Introduction
In Unity, variables are used to store values that can be used and manipulated by our ...
int score; // here, 'int' is the data type and 'score' is the namefloat speed; // here, 'float' is the data type and 'speed' is the namestring playerName; // here, 'string' is the data type and 'playerName' is the namebool isJumping; // here, 'bool' is the data type and 'isJumping' is the name
Initializing variables
Variables can be initialized with a value when they are declared. An example is given below:
int score = 0;float speed = 10.0f;string playerName = "Player1";bool isJumping = false;