using XCEngine; namespace Gameplay { public sealed class ObjectApiMarkerProbe : MonoBehaviour { } public sealed class ObjectApiDestroyTargetProbe : MonoBehaviour { public int DisableCount; public void OnDisable() { DisableCount++; } } public sealed class ObjectApiProbe : MonoBehaviour { public bool FoundSelfScriptViaParentLookup; public bool FoundSelfScriptViaGameObjectParentLookup; public bool FoundSelfTransformViaChildrenLookup; public bool FoundSelfTransformViaGameObjectChildrenLookup; public bool FoundCameraInParent; public bool FoundCameraInParentViaGameObject; public bool FoundMarkerInParent; public bool FoundMeshRendererInChildren; public bool FoundMeshRendererInChildrenViaGameObject; public bool FoundTargetScriptInChildren; public string ObservedParentCameraHostName = string.Empty; public string ObservedChildMeshRendererHostName = string.Empty; public string ObservedChildScriptHostName = string.Empty; public bool ChildCameraMissingAfterDestroy; public bool ChildScriptMissingAfterDestroy; public bool ChildGameObjectMissingAfterDestroy; public int ObservedChildScriptDisableCount = -1; public int ObservedChildCountAfterDestroy = -1; public void Start() { ObjectApiProbe selfViaParent = GetComponentInParent(); ObjectApiProbe selfViaGameObjectParent = gameObject.GetComponentInParent(); Transform selfViaChildren = GetComponentInChildren(); Transform selfViaGameObjectChildren = gameObject.GetComponentInChildren(); FoundSelfScriptViaParentLookup = selfViaParent == this; FoundSelfScriptViaGameObjectParentLookup = selfViaGameObjectParent == this; FoundSelfTransformViaChildrenLookup = selfViaChildren != null && selfViaChildren.GameObjectUUID == GameObjectUUID; FoundSelfTransformViaGameObjectChildrenLookup = selfViaGameObjectChildren != null && selfViaGameObjectChildren.GameObjectUUID == GameObjectUUID; Camera parentCamera = GetComponentInParent(); Camera parentCameraViaGameObject = gameObject.GetComponentInParent(); ObjectApiMarkerProbe parentMarker = GetComponentInParent(); MeshRenderer childMeshRenderer = GetComponentInChildren(); MeshRenderer childMeshRendererViaGameObject = gameObject.GetComponentInChildren(); ObjectApiDestroyTargetProbe childScript = GetComponentInChildren(); FoundCameraInParent = parentCamera != null; FoundCameraInParentViaGameObject = parentCameraViaGameObject != null; FoundMarkerInParent = parentMarker != null; FoundMeshRendererInChildren = childMeshRenderer != null; FoundMeshRendererInChildrenViaGameObject = childMeshRendererViaGameObject != null; FoundTargetScriptInChildren = childScript != null; if (parentCamera != null) { ObservedParentCameraHostName = parentCamera.gameObject.name; } if (childMeshRenderer != null) { ObservedChildMeshRendererHostName = childMeshRenderer.gameObject.name; } if (childScript != null) { ObservedChildScriptHostName = childScript.gameObject.name; } Transform firstChild = transform.childCount > 0 ? transform.GetChild(0) : null; GameObject child = firstChild != null ? firstChild.gameObject : null; if (child == null) { return; } Camera childCamera = child.GetComponent(); if (childCamera != null) { Destroy(childCamera); } ChildCameraMissingAfterDestroy = child.GetComponent() == null; if (childScript != null) { Destroy(childScript); ObservedChildScriptDisableCount = childScript.DisableCount; } ChildScriptMissingAfterDestroy = child.GetComponent() == null; Destroy(child); ChildGameObjectMissingAfterDestroy = GameObject.Find("Child") == null; ObservedChildCountAfterDestroy = transform.childCount; } } }