Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug that RootLIfetimeScope missing when Domain reloading is disabled #129

Merged
merged 1 commit into from
Feb 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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