OnInspectorDisposeImportantEnableSaintsEditorbefore using
Invoke a method when its target is disposed from the Inspector. The method can be an async or IEnumerator or a normal function. Any parameters must be optional. Returning value is ignored
using SaintsField; public bool error; [OnInspectorDispose] private void OnInspectorDispose() { if (error) { throw new Exception(quot;Expected Error! {GetId()}"); } Debug.Log(quot;Dispose done {GetId()}"); } [OnInspectorDispose] private IEnumerator OnInspectorAsync() { string id = GetId(); yield return new WaitForSeconds(2); Debug.Log(quot;Dispose async done {id}"); }