Skip to main content
The SusaPlay SDK is a Unity package written in C#. Your game runs inside the SusaPlay shell, and the SDK talks to the platform through that shell.
There is currently no JavaScript SDK. All examples below are C# for Unity.

Install

Add the package to your Packages/manifest.json:
Requires Unity 2021.3 or later, with the WebGL build target.

Initialize

Call Initialize() once on startup and await it before any other SDK call. It handshakes with the shell and populates every module.
Initialize() reads your game key from the PlatformConfig asset — create it with susaplay → Create Config Asset in the Unity menu. Do not hardcode the key. If the shell does not answer within 15 seconds, initialization logs an error and returns. The module properties stay null, so check before using them.

Identity

Identity is resolved by the shell during initialization. There is nothing to call.
Guest-to-account merging is handled by the platform when the player signs in. The game does not drive it.

Economy

Every wallet and inventory mutation happens server-side. The client can never write a balance.

Saves

Versioning is handled by the platform. Slot size is capped at 500 KB.

Analytics

session_start is emitted for you during Initialize(). See Analytics for details.

Error handling

SDK calls do not throw for platform errors — they return a result object with a success flag. Check it.
If the shell stops responding, requests time out and return an unsuccessful result rather than hanging.

Key rules

  • Await Initialize() before touching any module — the properties are null until it completes
  • Never hardcode the game key; it belongs in the PlatformConfig asset
  • Call MarkGameLoaded() once your first scene is playable, so the shell can hide its loader
  • Currency and inventory are server-authoritative — never track balances client-side as truth
  • Save writes are versioned by the platform; always read before you write in a new session