Setting up a leaderboard using PHP/MySQL

Games are more fun when there is a leaderboard of high scores that the players have achieved. Even single player games can communicate to a shared web-based leaderboard. This recipe includes both, the client side (Unity) code, as well as the web-server side (PHP) scripts to set and get the player scores from a MySQL database.

Setting up a leaderboard using PHP/MySQL

Getting ready

This recipe assumes that you either have your own web hosting, or are running a local web server and a database server, such as XAMPP or MAMP. Your web server needs to support PHP, and you also need to be able to create the MySQL databases.

All the SQL, PHP, and C# scripts ...

Get Unity 5.x Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.