As far as I can tell, you would have to create a script that will traverse all the items in the scene, saving their state in some sort of well specified/documented format (be it xml or binary or whatever). For things like transforms and the like this could easily be a generic class that would potentially be useful for others too.
But when it comes to custom scripts and saving their state you will have to write something specifically for those scripts.
Of course, with any saver you will have to write a loader, that will re-build the scene by adding the objects/prefabs to the scene via code and place in your variables.
Ultimately, you will need to design your file format very carefully especially if you plan to throw in new stuff at a later date and wish to save that too.
One potential method is to have all of your scripts have a SaveState() and LoadState() method in them if they’re attached to objects that need save/load. And in your saver function, as it traverses these items and encounters the scripts (you will need to make it look for these scripts) you can simply call SaveState() and it will return a string/data for your saver to work with.
One method of cycling all your scripts would be to structure your entire scene inside one single gameobject (“the scene”) and use getcomponentsinchildren to get all of said components from the objects
Here you could find all your SaverScript.js/cs scripts in the scene which could return to you relevant info about the object in which you’re trying to save (although, it can get very complicated if you’re talking about things like object scene hierarchy or things like the combinechildren script). Just an idea…
I’ve never tried it myself, but something like that is what I’dd probably attempt if I were to save out entire scenes including variable states e.t.c.
Sounds like a big project though and others might have better ideas about how to go about it than me, but it should work.
Ultimately, before you even build your scene you’ll need to think about how you’re going to structure it, how it’s going to be saved and how it’s going to be loaded. Sadly there is no easy ‘save/load’ state in Unity.
Good luck.