コード例 #1
0
 void Awake()
 {
     if (s_Instance == null)
     {
         s_Instance = this;
     }
     else
     {
         throw new UnityException("There cannot be more than one PlayerInput script.  The instances are " + s_Instance.name + " and " + name + ".");
     }
 }
コード例 #2
0
        void OnEnable()
        {
            if (s_Instance == null)
            {
                s_Instance = this;
            }
            else if (s_Instance != this)
            {
                throw new UnityException("There cannot be more than one PlayerInput script.  The instances are " + s_Instance.name + " and " + name + ".");
            }

            PersistentDataManager.RegisterPersister(this);
        }
コード例 #3
0
        void OnDisable()
        {
            PersistentDataManager.UnregisterPersister(this);

            s_Instance = null;
        }