Hi. i am completely new to Unity and want to create a Leaderboard(ScoreBoard)so that i can save the scores on a server. i have installed Xampp server also i have a free hosting setup. anyone can guide me how to do connect and save those scores and retrieve later… any Guidance will be helpful. sorry for my English but i am not a native speaker
Hi Farhan,
Installing XAMPP is a great first step, but you have a bit of additional work to do. I am going to describe the high level steps that you need to conduct in order to get it to work.
- Create a webservice in PHP which is capable of collecting scores and store them on a database, i.e., mysql database. This webservice has to offer an additional method to allow the game not only to submit scores, but also to get the top scores. I recommend you to have a look at the following tutorial to learn how to do it. PHP Mysql Tutorial or Creating a restful webservice in PHP. Here is also an example of a minimalistic php script that does the job PHP unity scoreboard example
- You will need to submit data to this webservice from the game. You can use the end screen of the game for this. Once you’ve collected the required data, you can use the WWWForm class to submit these scores. See this link for an example WWWForm example
- Last but not least, you probably also want to display the leaderboard at some point. For this purpose you can create a new PHP script which simply pulls the top scores from the database with a query. You can use the WWW class in Unity for this purpose.
I hope this helps!
Thanks bro. seems helpful. i’ll try and will respond.