Best way to save much objects

Is there a easy way to save much objects to Player prefs in unity ? Because if I have 1 player 10 variables and 20 enemies it’s much script to just use the regular playerpref way …

I usually try to make a saver/loader function for each class that I need to save. The saver function converts whatever values I need to a string and returns it. The loader is a static function that parses that string.

The master game controller finds all savable objects, calls Save() on each one and appends the returned value to a string to be saved with PlayerPrefs. For loading, the game controller retrieves that string, uses something like String.Split() and passes each string fragment to the static Loader function.

This obviously isn’t an implementation detailed description. The point is to think about “how would I save/load one object?” Make that into a function. Then think about “How would I use that function on all of my gameObjects?”

It’s good to think about what the absolute minimum number of details you actually need to save to return to a functionally equivalent gamestate.