How to define a variable in Unity using C#

How to define a variable in Unity using C#

· 1 min read

In C#, all are categorized into the following types:

  • Value types
  • Reference types
  • Pointer types
// basic values in Unity
int lives = 3;
float health = 100.0f;    // 100.0 will be treated as a double by default.
double heath = 100.0;
string playerName = "solider";


// reference type
GameObject go = new GameObject();


// pointers
Vector3* oldNew;
Vector3* curr;