Save prefab instance state between scenes,Remember prefab state when reloading scene

I use prefabs to build my dungeon crawler map, they are composed of cubes prefab with the apropriate texture, as well as a plane of the same size on top that is only shown to a second camera which I render in a texture to show the minimap.
I have a script attached to this cube, that uses raycast to check if the player passed near it, if it’s the case I change the plane material to one that shows there is a wall on the minimap (The plane is the color of the background before that, making the map blank).
The end result is what I expected, when I go near walls they draw themselves on the minimap. (I also extended this to floor tiles).
How do I save the state of the prefab instances between scenes, specifically the material of the plane?
I want to be able to go back to the floor later on and to have the map still display the wall I’ve gotten close to before.

In the end, to save the state of the prefabs, I made a list of bools.
I then iterated through every single one of my grid’s children prefab, and I accessed their script component, and stored the bool “discovered” in my list.
I store this list in a Json file.
For the load, I read the Json file where I stored this data, and I put it back in the component by going through the children’s of the grid again.
This however depends on the order of the child’s prefab so, changing the order of the prefabs invalidate any previously saved map.
In short, I store the bool of each of my prefabs in a Json file for later. The bool indicating if I already went near the wall before.
This makes for a truly Automatic Automap, that I can save between sessions and scenes.