using XCEngine; namespace Gameplay { public sealed class HierarchyProbe : MonoBehaviour { public GameObject ReparentTarget; public string ObservedParentName = string.Empty; public string ObservedFirstChildName = string.Empty; public string ReparentedChildParentName = string.Empty; public bool ParentLookupSucceeded; public bool ChildLookupSucceeded; public int ObservedChildCount; public void Start() { Transform currentParent = transform.parent; ParentLookupSucceeded = currentParent != null; if (currentParent != null) { ObservedParentName = currentParent.gameObject.name; } ObservedChildCount = transform.childCount; Transform firstChild = transform.GetChild(0); ChildLookupSucceeded = firstChild != null; if (firstChild != null) { ObservedFirstChildName = firstChild.gameObject.name; if (ReparentTarget != null) { firstChild.SetParent(ReparentTarget.transform, true); Transform newParent = firstChild.parent; if (newParent != null) { ReparentedChildParentName = newParent.gameObject.name; } } } } } }