[Editor] How to keep

I have a Monobehaviour that has [ExecuteInEditMode] on it that I’m using a [CustomEditor] with while working on a tool. The problem I’m facing is I have some indexes that live on the MonoBehaviour that I’m using to know which dropdown option is selected via the CustomEditor. When the project recompiles, I lose this information which is making tool development quite difficult. I’ve tried marking them with [SerializeField] but they still get wiped.

Do I need to use EditorPrefs? Some other approach here?

I think you would get further with a ScriptableObject solution instead of a MonoBehaviour, as this sounds sorta like a persistent editor state type object.

1 Like

Ah sure, something I can write to outside of play mode yeah?

1 Like

In and out… ScriptableObjects are a real time-and-place spanner when you start getting into them.