void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(this); } }
void Awake() { if (instance == null) { instance = this;; } else { Destroy(this); } }
public void DisplayError(string message) { // Create new error box GameObject errorBox = Instantiate(errorMessagePrefab) as GameObject; errorBox.transform.SetParent(GameObject.FindWithTag("GUICanvas").transform, false); ErrorMessageController script = errorBox.GetComponent <ErrorMessageController>(); // Set message script.SetErrorMessage(message); }