Save EditorWindow to disk

Hi,

Is there a way to save an editor window using AssetDatabase.CreateAsset() ?

What I have is a class that inherits EditorWindow, and it include multiple ScriptableObjects as its members. I have also set the hideFlags to HideAndDontSave in the OnEnable() method to prevent the window losing its data during serialization.

Now I want to save those ScriptableObjects from that editorWindow class to disk so I can load them later in the editor window.

Is this possible?

if not AssetDatabase.CreateAsset(), Even if I could serialize those objects to a file using any serialization method, that would be great.

Thank you.

ScriptableObjects have to be saved on their own. I’m not sure if you can save an editorwindow with CreateAsset, i’ve never tried this, but it might work since EditorWindows are also ScriptableObjects. I wrote an answer (+ a quite long comment) on this question a few hours ago.

edit
It seems that it’s not possible to save and retrive an EditorWindow via Unitys serialization system. See my comment below.