I am trying to get coroutine to work (to update, eg. tick a few frames) in editor mode.
I know coroutine is not supposed to work in editor mode because the lack of consistent update loop. But I find using EditorUtility.SetDirty(target)
in OnInspectorGUI
works.
public override void OnInspectorGUI () {
if (GUILayout.Button("Refresh")) {
EditorUtility.SetDirty(target);
}
}
If I keep clicking on the refresh button eventually the coroutine runs to completion.
My question: is it the best way? Obviously it’s a hack, but it seems to be the only solution besides entering play mode.