diff --git a/Build/BinaryMetas/Zenject.dll.meta b/Build/BinaryMetas/Zenject.dll.meta index 33d8fd23e..4b5b0bdb0 100644 --- a/Build/BinaryMetas/Zenject.dll.meta +++ b/Build/BinaryMetas/Zenject.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 39de377ce3657274f872ae938966268e -timeCreated: 1452187614 +timeCreated: 1454555684 licenseType: Pro PluginImporter: serializedVersion: 1 @@ -8,7 +8,8 @@ PluginImporter: executionOrder: Zenject.GlobalCompositionRoot: -9999 Zenject.SceneCompositionRoot: -9998 - Zenject.UnityEventManager: -9997 + Zenject.SceneDecoratorCompositionRoot: -9997 + Zenject.UnityEventManager: -9996 isPreloaded: 0 platformData: Any: diff --git a/UnityProject/Assets/Tests.meta b/UnityProject/Assets/Tests.meta deleted file mode 100644 index 4cb9d4391..000000000 --- a/UnityProject/Assets/Tests.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5c2ce4ffde6be404aba426d1e8f5a75d -folderAsset: yes -timeCreated: 1454260593 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/Zenject/Source/Main/GlobalCompositionRoot.cs b/UnityProject/Assets/Zenject/Source/Main/GlobalCompositionRoot.cs index ad7817dc9..d65731cb1 100644 --- a/UnityProject/Assets/Zenject/Source/Main/GlobalCompositionRoot.cs +++ b/UnityProject/Assets/Zenject/Source/Main/GlobalCompositionRoot.cs @@ -40,17 +40,20 @@ public static GlobalCompositionRoot Instance { get { - Assert.IsNotNull(_instance); + if (_instance == null) + { + _instance = new GameObject("Global Composition Root") + .AddComponent(); + _instance.Initialize(); + } + return _instance; } } - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - static void GlobalMainEntryPoint() + public void EnsureIsInitialized() { - _instance = new GameObject("Global Composition Root") - .AddComponent(); - _instance.Initialize(); + // Do nothing - Initialize occurs in Instance property } void Initialize() diff --git a/UnityProject/Assets/Zenject/Source/Main/SceneCompositionRoot.cs b/UnityProject/Assets/Zenject/Source/Main/SceneCompositionRoot.cs index 2a38d25be..5814e4287 100644 --- a/UnityProject/Assets/Zenject/Source/Main/SceneCompositionRoot.cs +++ b/UnityProject/Assets/Zenject/Source/Main/SceneCompositionRoot.cs @@ -52,6 +52,9 @@ public override IFacade RootFacade public void Awake() { + // We always want to initialize GlobalCompositionRoot as early as possible + GlobalCompositionRoot.Instance.EnsureIsInitialized(); + Assert.IsNull(Container); Assert.IsNull(RootFacade); diff --git a/UnityProject/Assets/Zenject/Source/Misc/UnityEventManager.cs.meta b/UnityProject/Assets/Zenject/Source/Misc/UnityEventManager.cs.meta index e0144a019..389744b1a 100644 --- a/UnityProject/Assets/Zenject/Source/Misc/UnityEventManager.cs.meta +++ b/UnityProject/Assets/Zenject/Source/Misc/UnityEventManager.cs.meta @@ -5,7 +5,7 @@ licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] - executionOrder: -9997 + executionOrder: -9996 icon: {instanceID: 0} userData: assetBundleName: diff --git a/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs b/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs index e67ed5713..ab23c0e47 100644 --- a/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs +++ b/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs @@ -28,6 +28,9 @@ public sealed class SceneDecoratorCompositionRoot : MonoBehaviour public void Awake() { + // We always want to initialize GlobalCompositionRoot as early as possible + GlobalCompositionRoot.Instance.EnsureIsInitialized(); + _beforeInstallHooks = SceneCompositionRoot.BeforeInstallHooks; SceneCompositionRoot.BeforeInstallHooks = null; diff --git a/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs.meta b/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs.meta index aeda3de20..bdaf66d82 100644 --- a/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs.meta +++ b/UnityProject/Assets/Zenject/Source/Util/SceneDecoratorCompositionRoot.cs.meta @@ -5,8 +5,8 @@ licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] - executionOrder: 0 + executionOrder: -9997 icon: {instanceID: 0} - userData: - assetBundleName: + userData: + assetBundleName: assetBundleVariant: