OnInspectorInitImportantEnableSaintsEditorbefore using
Invoke a method when its target is initialized in 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; [ShowInInspector] private bool _ran; [OnInspectorInit] private void OnInspectorInit() { _ran = true; if (error) { throw new Exception(quot;Expected Error! {GetId()}"); } Debug.Log(quot;Init done {GetId()}"); } [ShowInInspector] private bool _ranAsync; [OnInspectorInit] private IEnumerator OnInspectorAsync() { yield return new WaitForSeconds(2); _ranAsync = true; if (error) { throw new Exception(quot;Expected Error! {GetId()}"); } Debug.Log(quot;Async done {GetId()}"); }