gamemantra.aigamemantra.ai|Developer Docs

Reference

Player identity

Fields in Assets/Resources/gamemantra_config.json control how the SDK resolves the player before LoginPlayer. This page mirrors the inline documentation shipped in GameMantraConfig.cs inside your integration package.

Source of truth in repo

gamemantra/services/go-admin-server/handlers/unity_scripts/GameMantraConfig.cs

Rebuild go-admin-server after editing; scripts are embedded via //go:embed unity_scripts.

auto_login

When auto_login is true (default), the bootstrap coroutine calls LoginPlayer automatically on boot using the ID from ResolvePlayerId() (see player_id_source below). For custom and jwt, set auto_login to false and register the player from your own auth callback via GameMantraSDKHelper.

player_id_source

Pick the value that matches your game's auth model. Never mix strategies in the same build.

ValueBehaviourTypical auto_login
deviceUses SystemInfo.deviceUniqueIdentifier. Zero-friction; no user accounts required. Resets on device wipe.true
advertising_idUses Application.advertisingIdentifier. Requires user consent on iOS (ATT). Often more stable across reinstalls than device ID.true
customYou supply the ID after your auth system resolves it. Call GameMantraSDKHelper.SetGameUserId(userId) from your callback.false
jwtSDK decodes your JWT and reads the claim named by jwt_player_id_claim (default sub). Call SetPlayerFromJwt.false

Shipped comment block (C#)

The following is the exact documentation developers see in GameMantraConfig.cs in the downloaded package:

GameMantraConfig.cs (Player Identity region)
// ── Player Identity ────────────────────────────────────────────────────
// auto_login=true (default): SDK calls LoginPlayer() automatically on
//   boot. Choose player_id_source that matches your game's auth model:
//
//   "device"          Zero-friction. Uses SystemInfo.deviceUniqueIdentifier.
//                     Good for games with no user accounts.
//                     Resets on device wipe — players are re-matched by ML.
//
//   "advertising_id"  Uses Application.advertisingIdentifier.
//                     Requires user consent on iOS (ATT prompt).
//                     More stable than device ID across reinstalls.
//
//   "custom"          You supply the player ID after your auth system
//                     resolves it. Set auto_login=false and call
//                     GameMantraSDKHelper.SetGameUserId(userId) from
//                     your own auth callback. Example:
//
//                       // After Firebase login:
//                       FirebaseAuth.DefaultInstance.StateChanged += (s, e) => {
//                           if (e.auth.CurrentUser != null)
//                               GameMantraSDKHelper.SetGameUserId(e.auth.CurrentUser.UserId);
//                       };
//
//   "jwt"             SDK decodes your auth JWT and extracts the claim
//                     named by jwt_player_id_claim (default: "sub").
//                     Set auto_login=false and call:
//                       GameMantraSDKHelper.SetPlayerFromJwt(token);
//                     or:
//                       GameMantraSDKHelper.SetPlayerFromJwt(token, "user_id");

JSON snippets per strategy

device

gamemantra_config.json
{
  "player_id_source": "device",
  "auto_login": true
}

advertising_id

gamemantra_config.json
{
  "player_id_source": "advertising_id",
  "auto_login": true
}

custom (+ Firebase example from config comments)

gamemantra_config.json
{
  "player_id_source": "custom",
  "auto_login": false
}
Your auth script
// After Firebase login (from GameMantraConfig.cs comments):
FirebaseAuth.DefaultInstance.StateChanged += (s, e) => {
    if (e.auth.CurrentUser != null)
        GameMantraSDKHelper.SetGameUserId(e.auth.CurrentUser.UserId);
};

jwt

gamemantra_config.json
{
  "player_id_source": "jwt",
  "jwt_player_id_claim": "sub",
  "auto_login": false
}
Your auth script
GameMantraSDKHelper.SetPlayerFromJwt(token);
GameMantraSDKHelper.SetPlayerFromJwt(token, "user_id");

Experience / Dart overlay

The embedded Experience app uses GameMantraSDKClient.loginPlayer() (optional ID → auto UUID) and loginPlayerWithJwt. Unity studios editing only C# should follow this page and GameMantraConfig.