コード例 #1
0
 private void OnDestroy()
 {
     if (this == _instance)
     {
         _instance    = null;
         _isDestroyed = true;
     }
     Destroy(this);
 }
コード例 #2
0
        private void Awake()
        {
            if (_instance == null)
            {
                _instance = gameObject.GetComponent <PermissionPlugin>();
            }
            else if (_instance != this)
            {
                _instance.OnDestroy();
                _instance = gameObject.GetComponent <PermissionPlugin>();
            }

            DontDestroyOnLoad(this);
            Initialize();
        }