1
\$\begingroup\$

I want the player to be able to save his score when she makes it into top 10 of high scores. Upon success, player will be asked for a name to submit. This does not need to be unique per player. I just want a basic global score board available for everyone who plays the game via web player (from github.io page of the project).

When searched for how to keep high scores, I came across PlayerPrefs.

On Web players, PlayerPrefs are stored in binary files in the following locations:

  • Mac OS X: ~/Library/Preferences/Unity/WebPlayerPrefs
  • Windows: %APPDATA%\Unity\WebPlayerPrefs

As far as I understood, the results are kept in local machine and won't be same for everyone. So it's good for keeping track of your own score, locally.

As a placeholder in the current version of the game, I keep the scores in a local .txt file in the project directory. Can I succeed with this approach and use the github.io server to maintain a global scoreboard or do I necessarily need a database to achieve this goal?

\$\endgroup\$
1
\$\begingroup\$

If you want to have a shared leaderboard for all players, then PlayerPrefs is not what you want. It's designed to save a file to the player's local computer, which only they can access. For a global leaderboard, you'll need to implement a server-side component for the game to communicate with.

This page on the Unity wiki might be helpful to get you started.

\$\endgroup\$
1
\$\begingroup\$

Look at this tutorial: https://www.youtube.com/watch?v=UvKLmQ6VAtg

You will get the scripts / tutorial-package here: http://mole.bplaced.net/?page_id=32

It is very easy with this help and completly free...

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.