void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } gCaster = GetComponent <GraphicRaycaster> (); eSystem = FindObjectOfType <EventSystem> (); }
void Awake() { //Limits instances of this class to this public static "Instance" variable. //Use it from other classes to access public methods of this class. if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); return; } gCaster = GetComponent <GraphicRaycaster> (); eSystem = GetComponent <EventSystem> (); }