What are the basics of saving and loading game?

I know that saving a game is dependant on the game and it's content so there is no simple answer t this, but i can't seem to find a good explaination of how to do it...

i believe there are two ways to go about it, XML and Player Prefs or something? Can some1 please give me an explaination of either?


function SaveGame(){

what do i type here?So (HERE) i can enter the save game destination?;

& What do i say so that (this) is the data i save?;


Basics are:

  • Saving

    1.Decide what exact information u want to save

    2.Make a script that gathers this information in data array

    3.Make save menu(and pause game)

    4.Save this data array as txt file(for starting) on "Save button pressed". Better use binary files.

    5.Return to game.

  • Loading

    Make loading menu and loading screen.

    1. Let player choose which file to load
    2. Open your save file for input.
    3. Make a script that inputs data from your file to data array. Then it accepts specific data to specific

      objects on your scene. Of course you
      need to instantiate mostly all scene
      with all objects with properties from
      data array.

    4. Start game on loaded scene.

It is rather big code and it depends on what you want to save. You can read about import/export and files in reference documentation.