ldrboard blog

How to Add a FREE Online Leaderboard to Your Unity Game

Introduction

In this article, we will integrate a free online leaderboard into a Unity project using ldrboard.com, the standard leaderboard tool for Unity game developers. The process involves setting up the leaderboard, customizing it, generating necessary code, and integrating it into a Unity game.

Setting Up the Leaderboard

1. Login to Admin Dashboard:

   - Go to admin.ldrboard.com and log in with your credentials.

   - After logging in, select Create new game to set up the general information for your game.

   - Choose a subdomain where the leaderboard will be hosted (e.g., newplatformergame.ldrboard.com).

2. Create the Leaderboard:

   - Once the game is created, the initial leaderboard will be empty.

   - To customize it, navigate to the ldrboard section in the admin panel


   - In the "Schema" tab, add columns for the leaderboard such as level, kills, score, deaths, and time.

Customizing the Leaderboard

3. Adding and Organizing Columns:

   - Add desired columns (e.g., level as text, kills as a number).

   - Organize the columns by dragging them by the column header into the preferred order (e.g rank, user, level, kills, score, deaths, time, timestamp) and saving.

4. Selecting a Template:

   - Choose from available templates to customize the leaderboard's appearance in the Design Tab.

   - For example, select the circuitry template and configure settings such as sorting by level and best score.

Generating and Integrating Code

5. Code Generation:

   - Use the code generator on the website to generate the necessary code for the leaderboard.

   - Configure your settings

   - Generate


6. Integrate with Unity:

   - Copy the generated code and paste it into a new script in Unity called Ldrboard.cs (That’s it!).

Making Submissions in Unity

7. Script Modifications:

   - In your game controller script, call the leaderboard write function with the relevant game state data (e.g., level, kills, score).


8. Compiling and Testing:

   - Recompile the Unity project and ensure there are no errors.

   - Run the game, play through it, and submit a score.

   - Check the leaderboard page to see the new entry automatically populated.

Conclusion

This tutorial covered the essential steps to add a free online leaderboard to a Unity game. The process involves setting up and customizing the leaderboard, generating necessary code, and integrating it into your Unity project. The final result allows game scores to be submitted and displayed on the leaderboard seamlessly. Further customization and advanced settings will be explored in future tutorials. Check out the full video tutorial here and subscribe for future updates.


Get Started

Want to add a leaderboard to your game? At ldrboard.com we help game developers quickly setup fully customizable leaderboards for their games for free. Follow us on Twitter (X) or join our Discord to get updates on all things leaderboard.