diff --git a/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs b/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs index 078fbcde..830de8c2 100644 --- a/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs +++ b/VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs @@ -273,17 +273,6 @@ LifetimeScope GetRuntimeParent() if (VContainerSettings.Instance is VContainerSettings settings) { var rootLifetimeScope = settings.RootLifetimeScope; -#if UNITY_EDITOR - var disableDomainReloading = UnityEditor.EditorSettings.enterPlayModeOptionsEnabled && - (UnityEditor.EditorSettings.enterPlayModeOptions & - UnityEditor.EnterPlayModeOptions.DisableDomainReload) > 0; - if (rootLifetimeScope == null && disableDomainReloading) - { - var path = UnityEditor.AssetDatabase.GetAssetPath(rootLifetimeScope); - if (!string.IsNullOrEmpty(path)) - UnityEngine.Debug.LogError($"VContainerSettings.RootLifetimeScope is missing : {path}. Please try to re-compile C# scripts just once."); - } -#endif if (rootLifetimeScope != null) { if (rootLifetimeScope.Container == null) diff --git a/VContainer/Assets/VContainer/Runtime/Unity/VContainerSettings.cs b/VContainer/Assets/VContainer/Runtime/Unity/VContainerSettings.cs index a77dafc2..14541107 100644 --- a/VContainer/Assets/VContainer/Runtime/Unity/VContainerSettings.cs +++ b/VContainer/Assets/VContainer/Runtime/Unity/VContainerSettings.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using UnityEngine; -using VContainer.Unity; namespace VContainer.Unity { @@ -45,7 +44,7 @@ public static void CreateAsset() UnityEditor.PlayerSettings.SetPreloadedAssets(preloadedAssets.ToArray()); } - [UnityEditor.InitializeOnLoadMethod] + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] public static void LoadInstanceFromAssetDatabase() { var guids = UnityEditor.AssetDatabase.FindAssets("t:VContainerSettings");