Variables in Unity and C#
Variables are like containers in which we store some data. It can be a person’s name, his age, the name of a thing or its properties like color, size. In case of a game, it can be the number of points scored, level reached or player position and health. In C# and Unity we distinguish variables depending on the type of data we want to store.
Common Data Types
Specific C# data types are:
In most cases, during game development you will use string, integer, floating and boolean data types.
The specific Unity data types are:
In Unity engine we can also create variables of game and components. The GameObject is the most important concept in the Unity, every object in the game is a GameObject. The Transform and Animator are examples of components. The Transform component determines the Position, Rotation, and Scale of each object in the scene and the Animator is used to assign animation to a GameObject in your scene.
There are a great many components that you will learn about as you develop games and look through the Unity documentation.