So I was wondering if anybody could help me setup a script to save the level that the player is currently on and load it later, I’m not asking for somebody to write a script for me, but I am asking for a general direction on how I would write a script like this.
I know this isnt much help, but i was told to take a look at the player prefabs, apparently you can save variables and such (health, ammo, etc) I havent looked into it because im not at that stage but take a look see in the forum, its been discussed before
Either PlayerPrefs or saving/loading to your own files with StreamReader / StreamWriter:
function Save( filename ) {
var sw : StreamWriter = new StreamWriter( filename );
sw.WriteLine( MySaveFunction() );
sw.Close();
}
function MySaveFunction() : String {
return "Saved";
}
function Load( filename : String ) {
var sr : StreamReader = new StreamReader ( filename );
var input : String = "";
while ( true ) {
input = sr.ReadLine();
if ( input == null ) break;
// deal with input
}
sr.Close();
}