CoolAPI 2.0 for Unity
Ship your game on Cool GameX. Achievements, stats, leaderboards, cloud saves and DLC — with a setup window, an offline queue and secure per-game sessions. No dependencies, Unity 2021.3+.
Setup in 3 steps
Assets → Import Package → Custom Package… and pick CoolGameX-SDK.unitypackage. The setup window opens by itself.
Click Create settings, enter your game’s slug from the Creator dashboard and hit Test connection.
Use your Cool GameX account in the window. Play Mode now runs as you — test unlocks straight away.
That’s all. The SDK starts itself when your game launches — no Initialize() call and no scene object. When players start your game from the Cool GameX launcher, their session is picked up automatically.
Type-safe IDs New
Click Generate IDs in the setup window to get constants for every achievement and DLC — a typo becomes a compile error instead of a silently failed unlock:
using CoolGameX;
CoolGameXManager.Unlock(Ids.Achievements.SpeedRunner);
Achievements
Unlocks are idempotent — call them as often as you like. The event fires only the first time.
CoolGameXManager.Unlock("first_blood"); // fire-and-forget
UnlockResult r = await CoolAPI.Achievements.UnlockDetailed("first_blood");
if (r.NewlyUnlocked) PlayFanfare(); // r.Queued = saved offline, syncs later
// incremental: saves progress, unlocks at the target
await CoolAPI.Achievements.Progress("kill_100", kills, 100);
AchievementInfo[] all = await CoolAPI.Achievements.GetAll(); // with unlock state
CoolAPI.Achievements.Unlocked += a => ShowBanner(a.name, a.points);
Stats
Per-player numbers that follow the player across machines. No setup — a stat exists the first time you set it.
CoolGameXManager.AddStat("enemies_killed"); // +1
int total = await CoolAPI.Stats.Add("enemies_killed", 5); // returns the new total
await CoolAPI.Stats.Set("deepest_floor", 12);
int kills = await CoolAPI.Stats.Get("enemies_killed");
Leaderboards New
A board is created the first time you submit to it. By default only a player’s best score is kept.
SubmitResult r = await CoolAPI.Leaderboards.Submit("high_score", 9001);
if (r.Improved) ShowNewBest(r.Rank);
// lower is better (speedruns)
await CoolAPI.Leaderboards.Submit("fastest_run", 83250, SortOrder.Ascending);
LeaderboardPage top = await CoolAPI.Leaderboards.GetTop("high_score", 10);
LeaderboardPage mine = await CoolAPI.Leaderboards.GetAroundMe("high_score", range: 3);
Cloud saves New
Named slots per player, per game — up to 50 slots of 512 KB. Save any [Serializable] class.
[System.Serializable] class SaveData { public int level; public float health; }
await CoolAPI.CloudSave.Save("slot1", new SaveData { level = 7, health = 80 });
SaveData data = await CoolAPI.CloudSave.Load<SaveData>("slot1");
SaveSlot[] slots = await CoolAPI.CloudSave.List();
DLC & ownership
if (await CoolAPI.DLC.Owns(Ids.DLC.HauntedExpansion)) UnlockExpansion();
bool fullGame = await CoolAPI.Ownership.OwnsGame(); // demo vs. full content
PlayerProfile me = await CoolAPI.Player.GetProfile(); // "Welcome back, davi!"
Reliability & security
- Offline queue — unlocks, stat changes and playtime made offline are saved on the device and synced automatically when the connection returns.
- Secure sessions — games started from the launcher get a token scoped to that one game. It can’t touch the player’s account, lasts 12 hours and refreshes itself.
- Automatic retries for network hiccups, and readable error messages from the server.
- Playtime is tracked for you — by the launcher when it starts the game, by the SDK otherwise — never twice.
- Debug overlay — press F8 in Play Mode or a development build: connection, session, queued changes, one-click test unlocks and the recent SDK log.
Manual control (optional)
Turn off Auto-start in the setup window and start the SDK yourself, or add the Cool GameX Manager component to your first scene. The 1.x API still works.
bool signedIn = await CoolAPI.InitializeAsync();
API reference
CoolAPI
| Member | Description |
|---|---|
InitializeAsync() | Configure, connect and sign in. Returns true when signed in. |
IsConnected · IsAuthenticated | Connection and session state. |
ConnectionChanged · SignedIn | Events. |
LaunchedFromLauncher | True when started by Cool GameX. |
LastError · LogLevel · StatusLine() | Diagnostics. |
Modules
| Module | Methods |
|---|---|
Achievements | Unlock, UnlockDetailed, Progress, GetAll, IsUnlocked, Unlocked event |
Stats | Set, Add, Get, GetAll |
Leaderboards | Submit, GetTop, GetAroundMe |
CloudSave | Save, Save<T>, Load, Load<T>, Delete, List |
DLC · Ownership | Owns, ListOwned · OwnsGame |
Player | GetProfile, Name |
Queue | PendingCount, Flush, Changed event |
CoolGameXManager | Static Unlock, SetStat, AddStat, SubmitScore |
What’s new in 2.0
- Setup window with Editor sign-in, test unlocks and type-safe ID generation.
- Zero-code start from a settings asset.
- Leaderboards, cloud saves, player profile and ownership checks.
- Offline queue, automatic retries and an F8 debug overlay.
- Secure game-scoped sessions that refresh automatically (no more 1-hour expiry).
- Fully backwards compatible — 1.x code and scenes keep working. Import over the old version to upgrade.