- Home /
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?
e.g
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?;
}
http://answers.unity3d.com/questions/971/how-to-scrip-a-save-load-game-option
Here is enough stuff for starting. Also there is a lot about exporting arrays to X$$anonymous$$L in Adobe ActionScript 3 reference. You can write a few scripts in Flex Builder(As I was doing at first time, because I started FlexBuilder much earlier than Unity). There is a free version of FB by the way.
Answer by Simple · Feb 05, 2011 at 04:32 PM
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.
- Let player choose which file to load
- Open your save file for input.
- 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. - 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.
good answer, thanx for the response. i understand what i want to save... things like players name, level, stats and inv items but what i need to know is how to script the filepath for a savefile. I have traulled through the documents for the past week and can't find what i'm lookin for.
Application.dataPath Contains the path to the game data folder. $$anonymous$$ore info: http://docs.unity3d.com/Documentation/ScriptReference/Application-dataPath.html
Your answer
Follow this Question
Related Questions
How can I save and load a player's position? 5 Answers
Saving a randomly generated Terrain 1 Answer
Save/Load/New 1 Answer
Save/Load Game and buttons New Game/Load Game? 1 Answer
How to save data with the webplayer avaiable to all users? 1 Answer