Skip to content

Commit ee940ef

Browse files
authored
Merge pull request #744 from jonah1nine/apply-remove-clone-postfix-to-root-lifetime-scope
Apply VContainerSettings' RemoveClonePostfix to the root lifetime scope
2 parents d0a9ac4 + cd9b4ab commit ee940ef

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: VContainer/Assets/VContainer/Runtime/Unity/VContainerSettings.cs

+7
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public LifetimeScope GetOrCreateRootLifetimeScopeInstance()
7575
RootLifetimeScope.gameObject.SetActive(false);
7676

7777
rootLifetimeScopeInstance = Instantiate(RootLifetimeScope);
78+
SetName(rootLifetimeScopeInstance, RootLifetimeScope);
7879
DontDestroyOnLoad(rootLifetimeScopeInstance);
7980
rootLifetimeScopeInstance.gameObject.SetActive(true);
8081

@@ -120,5 +121,11 @@ void OnFirstSceneLoaded(Scene scene, LoadSceneMode mode)
120121
}
121122
SceneManager.sceneLoaded -= OnFirstSceneLoaded;
122123
}
124+
125+
static void SetName(Object instance, Object prefab)
126+
{
127+
if (Instance != null && Instance.RemoveClonePostfix)
128+
instance.name = prefab.name;
129+
}
123130
}
124131
}

0 commit comments

Comments
 (0)