void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else {
         Destroy(this);
     }
 }
示例#2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;;
     }
     else
     {
         Destroy(this);
     }
 }
示例#3
0
    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);
    }