Skip to content

Commit

Permalink
Merge pull request #129 from hadashiA/ku/fix-root-scope-missing
Browse files Browse the repository at this point in the history
Fix a bug that RootLIfetimeScope missing when Domain reloading is disabled
  • Loading branch information
hadashiA authored Feb 14, 2021
2 parents 0206ca2 + 2163f58 commit d280d05
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
11 changes: 0 additions & 11 deletions VContainer/Assets/VContainer/Runtime/Unity/LifetimeScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using UnityEngine;
using VContainer.Unity;

namespace VContainer.Unity
{
Expand Down Expand Up @@ -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");
Expand Down

1 comment on commit d280d05

@vercel
Copy link

@vercel vercel bot commented on d280d05 Feb 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.