Is there a way to do highscore on a web browser game?
thanks
Is there a way to do highscore on a web browser game?
thanks
You mean a world wide high score table? Try this:
I recommend talking to the author if you run into trouble.
Actually I was meaning highscore that remains on a local computer. I don’t think I am ready to tackle the web yet, although that day will come.
thanks
In that case, you can use browser cookies via this script:
(Be sure to scroll down to the example at the bottom.)
-Jon
So is there a way to make a highscore table local to the mahine the game is running to, i.e. offline?
For an offline standalone player you could simply use file reading/writing.
For localized web player scores you could do an all-cookie solution or simply create and store a unique ID for that user for a database solution (benefit there is it would be easy to toggle between global scores and local scores).
Ok, so for the file reading/writing, is there any documentation, or does anyone know how to use it for the purposes of a highscore table?
Use the Mono libraries. Go here for documentation
http://www.go-mono.com/docs/ → Class Libraries - > System.IO
ok, erm, i dont spose someone knows or has a tutorial of some kind that could guide me to making an offline highscore table, local to the computer it is playing on.
Big ask i know, but i just wouldn’t know what to do with the mono libraries. Sorry.
System.IO is disabled in the web player for security reasons. (Wouldn’t want some random website writing/reading your files!) The only way to store local data with the Web player is cookies. The link I gave gives pretty darn close to a tutorial. Which problems did you have with it?
-Jon
edit: If you don’t care about the web player, you can use PlayerPrefs:
http://unity3d.com/Documentation/ScriptReference/PlayerPrefs.html
Erm, i just had problems understanding what to do with the information from the previous link, but this one seems to make more sense. It’s just that my project won’t be online, so i need a highscore table that works purely on the computer it is played on. I’ll give the player preferences a go, but how would i go about storing the prefrences to a file that would kepp the information when the application is quit, and then still in place when loaded up again?
Sorry for the enormity of questions, im just having trouble with this one in particular, and im quite keen on understanding how to do it.
Cheers again.
Player preferences do that.
You don’t choose what file the stuff gets written into, though. They get written into a .plist file specific to that user and that application. This is usually what you want though. The next time that user runs your program, when the code reads back from the preferences it will see the values that were written.