Data persistance between Edit and Play Mode

First a short overview. I’m making a grid based game, in which every tile has a TileType. The TileType is a class with properties such as unwalkable, blocks sight etc. The TileType instances are arranged in a Dictionary that uses grid coordinates as key. This lets me look up the TileType for any tile on the grid, and it works great for the most part.

However, I get some problems with data persistence between edit mode and play mode. The thing is, the grid is edited in edit mode. And sometimes when I try it out in play mode, it seems the dictionary resets when I exit play mode. What would be a good way to store the dictionary in such a way that it persists between play mode and edit mode? I’m thinking maybe scriptable objects, but I haven’t quite been able to wrap my head around what they are for and how they work, so I’m not sure about that.

Any suggestions?

Did you ever manage to get data persistence when exiting Play Mode?

I’m currently using ScriptableObjects to pass data between Play Mode and Edit Mode, and it works for passing data into Play Mode, but all changes get lost when I switch back to Edit Mode. I thought that one of the key strengths of ScriptableObjects is that their data is persistent between Play and Edit Modes, but so far, the Unity Editor has proven me wrong.