Exemplo n.º 1
0
 public void InitializeIfNecessary()
 {
     if (!_hasInitialized)
     {
         _hasInitialized = true;
         _dependencyRoot.Initialize();
     }
 }
Exemplo n.º 2
0
 public void Start()
 {
     // Always run the IInitializable's at the very beginning of Start()
     // This file (SceneCompositionRoot) should always have the earliest execution order (see SceneCompositionRoot.cs.meta)
     // This is necessary in some edge cases where parts of Unity do not work the same during Awake() as they do in Start/Update
     // For example, changing rectTransform.localPosition does not automatically update rectTransform.position in some cases
     // Also, most people treat Awake() as very minimal initialization, such as setting up a valid state for the
     // object, initializing variables, etc. and treat Start() as the place where more complex initialization occurs,
     // so this is consistent with that convention as well
     GlobalCompositionRoot.Instance.InitializeIfNecessary();
     _dependencyRoot.Initialize();
 }