コード例 #1
0
    private void Awake()
    {
        StartCoroutine(LoadSavesAndSerializers());

        Loom.Initialize();
        if (Reference == null)
        {
            Reference = ScriptableObject.CreateInstance <StoredReferences>();
        }
        if (Application.isEditor)
        {
            GetAllInactiveGameObjects();
        }
        if (Instance != null && Instance != this)
        {
            if (Application.isEditor)
            {
                DestroyImmediate(Instance.gameObject);
            }
            else
            {
                Destroy(Instance.gameObject);
            }
        }

        Instance = this;
        hasWoken = true;
        if (Application.isPlaying && !hasRun)
        {
            _cached = Reference;
            hasRun  = true;
        }
        else if (!Application.isPlaying)
        {
            hasRun = false;
            if (_cached != null && _cached.Count > 0)
            {
                Reference = _cached.Alive();
            }
        }
        if (_initActions.Count > 0)
        {
            foreach (var a in _initActions)
            {
                a();
            }
            _initActions.Clear();
        }
    }
コード例 #2
0
 void Awake()
 {
     Loom.Initialize();
     if (Reference == null)
     {
         Reference = ScriptableObject.CreateInstance <StoredReferences>();
     }
     if (Application.isEditor)
     {
         GetAllInactiveGameObjects();
     }
     if (Instance != null && Instance != this)
     {
         Destroy(Instance.gameObject);
     }
     Instance = this;
     hasWoken = true;
     if (Application.isPlaying && !hasRun)
     {
         _cached = Reference;
         hasRun  = true;
     }
     else if (!Application.isPlaying)
     {
         hasRun = false;
         if (_cached != null && _cached.Count > 0)
         {
             Reference = _cached.Alive();
         }
     }
     if (_initActions.Count > 0)
     {
         foreach (var a in _initActions)
         {
             a();
         }
         _initActions.Clear();
     }
     //giving errors, I don't think the previous people got saving working anyway.
     //I'll look into why if I have time.  If not, sorry to whoever has to.************
     //DontDestroyOnLoad (transform.gameObject);
 }
コード例 #3
0
 void Awake()
 {
     if (Reference == null)
     {
         Reference = ScriptableObject.CreateInstance <StoredReferences>();
     }
     GetAllReferences();
     if (Application.isEditor)
     {
         GetAllInactiveGameObjects();
     }
     if (Instance != null && Instance != this)
     {
         Destroy(Instance.gameObject);
     }
     Instance = this;
     hasWoken = true;
     if (Application.isPlaying && !hasRun)
     {
         _cached = Reference;
         hasRun  = true;
     }
     else if (!Application.isPlaying)
     {
         hasRun = false;
         if (_cached != null && _cached.Count > 0)
         {
             Reference = _cached.Alive();
         }
     }
     if (_initActions.Count > 0)
     {
         foreach (var a in _initActions)
         {
             a();
         }
         _initActions.Clear();
     }
 }