How to prevent Editor script variables resetting at runtime

Variables and arrays are getting reset in my custom editor script when I play the scene. How can I make these variables persistent even when quitting and re-opening Unity?

You need to use EditorPrefs for editor variables. Make them static and they will persist inside the same session, but not after a code edit.

Easiest way to populate default values in MonoBehaviour.Reset method