diff --git a/UnityProject/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs b/UnityProject/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs index 3a60b1b0b..82432bccf 100644 --- a/UnityProject/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs +++ b/UnityProject/Assets/Plugins/Zenject/Source/Install/Contexts/ProjectContext.cs @@ -101,9 +101,13 @@ static void InstantiateAndInitialize() ProfileBlock.UnityMainThread = Thread.CurrentThread; #endif +#if UNITY_6000 + Assert.That(FindObjectsByType(FindObjectsSortMode.None).IsEmpty(), + "Tried to create multiple instances of ProjectContext!"); +#else Assert.That(FindObjectsOfType().IsEmpty(), "Tried to create multiple instances of ProjectContext!"); - +#endif var prefab = TryGetPrefab(); var prefabWasActive = false; diff --git a/UnityProject/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs b/UnityProject/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs index e262b211a..0b07f0fc0 100644 --- a/UnityProject/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs +++ b/UnityProject/Assets/Plugins/Zenject/Source/Util/UnityUtil.cs @@ -127,7 +127,12 @@ public static IEnumerable GetDirectChildren(GameObject obj) public static IEnumerable GetAllGameObjects() { +#if UNITY_6000 + return Object.FindObjectsByType(FindObjectsSortMode.None) + .Select(x => x.gameObject); +#else return GameObject.FindObjectsOfType().Select(x => x.gameObject); +#endif } public static List GetAllRootGameObjects()