Skip to content

Commit

Permalink
Merge pull request #744 from jonah1nine/apply-remove-clone-postfix-to…
Browse files Browse the repository at this point in the history
…-root-lifetime-scope

Apply VContainerSettings' RemoveClonePostfix to the root lifetime scope
  • Loading branch information
hadashiA authored Jan 17, 2025
2 parents d0a9ac4 + cd9b4ab commit ee940ef
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public LifetimeScope GetOrCreateRootLifetimeScopeInstance()
RootLifetimeScope.gameObject.SetActive(false);

rootLifetimeScopeInstance = Instantiate(RootLifetimeScope);
SetName(rootLifetimeScopeInstance, RootLifetimeScope);
DontDestroyOnLoad(rootLifetimeScopeInstance);
rootLifetimeScopeInstance.gameObject.SetActive(true);

Expand Down Expand Up @@ -120,5 +121,11 @@ void OnFirstSceneLoaded(Scene scene, LoadSceneMode mode)
}
SceneManager.sceneLoaded -= OnFirstSceneLoaded;
}

static void SetName(Object instance, Object prefab)
{
if (Instance != null && Instance.RemoveClonePostfix)
instance.name = prefab.name;
}
}
}

0 comments on commit ee940ef

Please sign in to comment.