WavedashDocs

Unity

Add the Wavedash Unity package and publish through WebGL builds.

Add the Wavedash Unity package, configure your WebGL build settings, and call the C# SDK through the JavaScript bridge.

View on GitHub

Install the SDK

Open Window > Package Manager, click + > Install package from git URL..., and paste:

https://github.com/wvdsh/sdk-unity.git

WebGL build settings

  1. Switch to WebGL platform in File > Build Settings
  2. In Player Settings, set compression to Gzip or Brotli and enable decompression fallback
  3. Select the Default WebGL template (not Minimal)
  4. Build to a folder you set as upload_dir in wavedash.toml

The Minimal template omits the buildUrl variable in index.html. The Wavedash CLI expects that variable. Use Default.

Use the SDK from C#

void Awake()
{
    Wavedash.SDK.Init(new Dictionary<string, object> { { "debug", true } });
    Wavedash.SDK.ReadyForEvents();
}

async void LogPlayerAndScore()
{
    var user = Wavedash.SDK.GetUser();
    Debug.Log(user != null ? user["username"] : "no user");

    var result = await Wavedash.SDK.UploadLeaderboardScore("high-scores", 1500, keepBest: true);
    if (result != null) Debug.Log($"rank {result["rank"]}");
}

wavedash.toml

game_id = "YOUR_GAME_ID_HERE"
upload_dir = "./Builds/WebGL"

[unity]
version = "6000.0.2f1"