- Home /
Database connection on PhPMyAdmin
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
I am using a free hoisting service. i.e 000wehost.com
Answer by senc01a · Aug 18, 2014 at 08:58 AM
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!
Answer by Farhan-Aqeel · Aug 19, 2014 at 07:31 AM
Thanks bro. seems helpful. i'll try and will respond. :)
Your answer
Follow this Question
Related Questions
Finish setup php, how to communicate with mySQL and unity 2 Answers
Sql Server Compact 4.0 error 2 Answers
Login from database in unity 0 Answers
Inventory with a Database 0 Answers
MySQL Database Highscore 0 Answers