Skip to content

Leaderboard Sample

A simple clicker game sample demonstrating Beamable's Leaderboard system. In this game, button clicks grow trees. Click as many times as possible within the time limit.

Features

Beamable Features Used

This sample demonstrates integration with Beamable services:

Game Rules

  • Players have a limited time to click and grow their tree
  • Each click increases the current score
  • The goal is to achieve the highest score possible within the time limit
  • Scores are submitted to a global leaderboard for competition
  • The tree grows visually based on the player's performance relative to the global high score

Project Repository

The code for the Leaderboard ABC Sample is available at Leaderboard ABC Sample Project.

Screenshots

Intro Scene Game Scene Leaderboard Scene Project Structure
ABC Intro Scene ABC Game Scene ABC Leaderboard Scene ABC Project

Download

Source Detail
Beamable 1. Download the Leaderboard ABC Sample Project
2. Open in Unity Editor (Version 2021.3 or later)
3. Open the Beamable Toolbox
4. Sign-In / Register To Beamable. See Getting Started for more info
5. Open the Content Manager Window and click "Publish". See Content Manager for more info
6. Open the 1.Intro Scene
7. Play The Scene: Unity → Edit → Play
8. Enjoy!

Note: Sample projects are compatible with supported Unity versions

Implementation Guide

This sample demonstrates key Beamable integration patterns for leaderboards and stats.

Key Components

IntroSceneManager.cs - Handles Beamable SDK initialization and connectivity checks

1
2
3
4
5
6
7
8
9
private async void SetupBeamable()
{
    _beamContext = BeamContext.Default;
    await _beamContext.OnReady;

    // Handle connectivity changes
    _beamContext.Api.ConnectivityService.OnConnectivityChanged += 
        ConnectivityService_OnConnectivityChanged;
}

GameSceneManager.cs - Manages game logic and leaderboard score submission

1
2
3
4
private void SetLeaderboardScore(LeaderboardContent leaderboardContent, double score)
{
    _beamableAPI.LeaderboardService.SetScore(leaderboardContent.Id, score);
}

Additional Experiments

Try these optional experiments to extend the sample:

Difficulty Experiment Description
Beginner Tweak Configuration Modify timing and animation settings in Configuration.asset
Beginner Add Input Methods Add keyboard input alongside mouse clicks
Intermediate Difficulty Levels Implement multiple difficulty levels with varying time limits
Advanced Tree Varieties Create different tree types with unique growth animations

Advanced Topics

Using Beamable Stats

This sample uses Beamable Stats to track player progress. While not strictly necessary for a simple clicker game, Stats demonstrate how to store and retrieve player-specific data.

Managing Leaderboards via Portal

The Portal allows game makers to manage leaderboards, view player scores, and configure leaderboard settings.

Configuration Note

The Configuration.cs in this sample is unrelated to Beamable's Configuration Manager. It's a project-specific ScriptableObject for game settings.