Matches root transform with tag.

This commit is contained in:
2023-04-20 11:37:19 +08:00
parent 61b72107ae
commit 251b7bc352
2 changed files with 3 additions and 1 deletions

View File

@@ -115,8 +115,10 @@ namespace Cryville.Crtr.Event {
#region Logic #region Logic
#region Init methods: Called on prehandle #region Init methods: Called on prehandle
const string TagRootTransform = "RT";
public virtual void PreInit() { public virtual void PreInit() {
RootTransform = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform; RootTransform = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
RootTransform.tag = TagRootTransform;
SkinContext = new SkinContext(RootTransform); SkinContext = new SkinContext(RootTransform);
if (cs.Parent != null) if (cs.Parent != null)
RootTransform.SetParent(cs.Parent.Handler.RootTransform, false); RootTransform.SetParent(cs.Parent.Handler.RootTransform, false);
@@ -132,7 +134,7 @@ namespace Cryville.Crtr.Event {
ChartPlayer.etor.ContextEvent = null; ChartPlayer.etor.ContextEvent = null;
ChartPlayer.etor.ContextState = null; ChartPlayer.etor.ContextState = null;
foreach (Transform child in RootTransform) { foreach (Transform child in RootTransform) {
if (child.name.Contains(':')) continue; if (child.CompareTag(TagRootTransform)) continue;
_comps.AddRange(child.GetComponentsInChildren<SkinComponent>()); _comps.AddRange(child.GetComponentsInChildren<SkinComponent>());
} }
foreach (var i in _comps) i.Init(); foreach (var i in _comps) i.Init();

Binary file not shown.