i know this has probably been asked a lot but how DO you save a game can someone tell me or at least point me to a link i can find the answer on.
In the doc’s Scripting reference, You will see a PlayerPref class that will explain the basics of saving your game. Besides that there are a few Save game state editor class methods that cost money that were created by Users. around 100.00 Bucks. There(that i know of) are not any real solid examples of a save game script cause the script would have to suit your own needs and variables and such. ![]()
well i mean what would be the basic idea behind it. i can make it fit my game but does anyone know what function i would use or stuff like that?
Here is a small example of savving i found in the forum.
var highScore = 0;
var score = 9999;
function save(){
PlayerPrefs.SetInt("High Score", score);
}
function load(){
highScore = PlayerPrefs.GetInt("High Score");
}
Im not sure but i think you can call this playerpref command in your own custom functions. 8)
Ignore this one it was just pushing the button too many times lol :lol:
thanks it works. but i was wondering does it work on webplayers? and if so is it any different?
I have never tested it on a web player.
Maybe you could answer somthing for me?
How /where do you insert the line in the HTML doc to find the dat file? do you have to upload your dat file to a media hosting site and then insert the link?
i have no idea what you asking me. can you explain what file your talking about?
if you talking about embeding the game file on an html page unity automaticly makes an html page that embeds the game. you dont really have to do any embedding you can just use the defualt page.
When trying to load the data file that builds with your HTML link from other PC’S it says it did not download the data file. the only way to get it to work that i know of is to have the file present.
So im not sure how to get it to play from other PC’S i just tried my first web player last night and could;nt get it to load from my other pc.
is there any steps im missing. (im sure there is lol) ![]()
did you upload both the .html file and the .unity3d file to a web host? also the html page and the .unity3d file need to be in the same directory (or you will need to edit the page to point to the directory its in)
i have another question. if PlayerPrefs.GetInt(“Player Score”) is not saved what will it return. will it just come back as 0?
drazil austin - PlayerPrefs returns a 0 if no data exists, unless you use the second parameter to specify a different default.
No i did’nt upload it to a media hosting site(what is a good/free one) so the link to the uploaded HTML is what i would need to load the data file. as u can tell i have never done thta before. lol ![]()
to play it you need 2 things. you need a .unity3d file (wich is the gmae itself) and the htnl page that plays it. (i recomend building it in its own folder. this way you can find both files easier)
ok so i updated my platforms game and now it saves your progress so you can continue where you left off. when you beat the game it give you a level select so you can replay any level.