using System; using UnityEngine; namespace Unity.XR.CoreUtils { /// /// that invokes a callback when it is destroyed. /// [AddComponentMenu("")] [ExecuteInEditMode] [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.core-utils@2.0/api/Unity.XR.CoreUtils.OnDestroyNotifier.html")] public class OnDestroyNotifier : MonoBehaviour { /// /// Called when this behavior is destroyed. /// public Action Destroyed { private get; set; } void OnDestroy() { Destroyed?.Invoke(this); } } }