share one string between two editor windows?

Hello guy, i’m working on a my personal Editor gui extension for unity.

I have one main editor window, that store one string variable.
When i click a button in this main window, i would create a second editor window where is show my previous string.
I can’ t do this, i don’t know ho to share the string between the 2 editor windows.
Please can help me with an example?

Thank you, bye, alex

If you want it to persist between instances of the window(s), you could save the string to EditorPrefs.

If you know there’s only going to be one instance, you could make the string a static variable in the main class.

If no need to persist between sessions (editor/play mode, recompiling, restarting UnityEditor) than a static variable or the Singleton variable is enough.

Or else, EditorPrefs.