using UnityEngine; using UnityEngine.UI; [DefaultExecutionOrder(-100)] public class UIAutoRegisterSound : MonoBehaviour { void Awake() { // Register the entire hierarchy of this prefab UISystemBootstrap.RegisterHierarchy(gameObject); // Remove this component as its job is done Destroy(this); } }