Set up global variable in Unity

· 1 min read

Keep your global variables separately is always a good practice no matter what programming language you are working with.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AppConstants : MonoBehaviour {
	public static int ENEMY1_SCORE = 10;
}

To use them:

Debug.Log(AppConstants.ENEMY1_SCORE);