please help me, Scriptable object's variable serialization issue

I have a dictionary stored in a ScriptableObject, which then is saved as an asset.

Dictionary<Transform, Nodescript> ScriptViaTransform = new Dictionary<Transform, Nodescript>();

Once I load the asset, my editor classes can pass values for storage, but if I Enter/Exit playmode, it looks like the dictionary re-initializes itself. This wipes all the keys/values :<

Question, how to store the dictionary data in a Scriptable object so that its dictionary doesn’t re-initialize itself upon the initialization? And how do I initialize dictionary only once?

Thank you

Since you added the ‘serialization’ tag, I’m assuming you know your problem is with saving a dictionary to a file, and you’re not looking for some in-code magic to persist a variable across runtimes.

Howerver, a dictionary is not serialize-able by default, so you cannot save it to a file and reload its state. There are a bunch of answers and forum posts and tutorials (and assets on the store) which provide the concept of a serialize-able dictionary, so I would start there. Other than that, you can always change data structures, or attempt to write your own version of a serialize-able dictionary.

This, for example, seems like a good place to start.