コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        DontDestroyOnLoad(gameObject);
    }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: BenjaBobs/Hubris
        // UIManager methods
        public override void OnEnable()
        {
            base.OnEnable();

            if (Instance == null)
            {
                Instance = this;
            }
            else if (Instance != this)
            {
                Destroy(this.gameObject);
                return;
            }

            DontDestroyOnLoad(this);

            if (DevCanvas != null)
            {
                DevCanvas.SetActive(HubrisCore.Instance.Debug);
            }

            _msgList   = new List <Msg>();
            _inputList = new List <string>();
        }