# Tutorial — your first achievement in 10 minutes

This walks you from zero to an achievement popping up in Cool GameX, using
**CoolAPI 2.0**. No tokens to copy, no setup code.

---

## 1. Create the game on Cool GameX

1. Open the Cool GameX launcher → **Creator** (sidebar) → **New game**.
2. Give it a title. Note the **slug** it gets (e.g. `my-cool-game`) — that's your game's ID.
3. Open the game → **Achievements** → add one, e.g. slug `first_steps`, name *First Steps*.
4. Visibility can stay **Draft** while you develop — the SDK works with drafts.

## 2. Add CoolAPI to Unity

1. Download **CoolGameX-SDK.unitypackage** from https://coolgamex.com/sdk.html
   (or *Creator → Unity SDK → Download*).
2. In Unity: **Assets › Import Package › Custom Package…** → pick the file → **Import**.
3. The **Cool GameX** setup window opens. (Later: *Tools › Cool GameX › Setup*.)

## 3. Configure

1. Click **Create settings**.
2. **Game slug**: `my-cool-game` (yours).
3. Leave **Server URL** as is and click **Test connection** → *Connected*.

## 4. Sign in for testing

Enter your Cool GameX **email** and **password** under *Sign in for testing* and click
**Sign in**. Only a short-lived test session for this game is stored on your machine —
never your password, and never in your project files.

Your achievements load in section 3 of the window. Click **Test unlock** next to one to
check everything works — it unlocks on your account immediately.

## 5. Generate IDs (recommended)

Click **Generate IDs**. You now have compile-checked constants:

```csharp
Ids.Achievements.FirstSteps   // "first_steps"
```

Re-generate whenever you add achievements or DLC.

## 6. Unlock it from gameplay

Anywhere in your code:

```csharp
using CoolGameX;
using UnityEngine;

public class FinishLine : MonoBehaviour
{
    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
            CoolGameXManager.Unlock(Ids.Achievements.FirstSteps);
    }
}
```

No `Initialize()` call — the SDK starts itself. Press **Play**, trigger it, and you'll see
an *Achievement unlocked* toast in the corner of the Game view.

> Press **F8** in Play Mode for the debug overlay: connection, session, queued changes,
> test-unlock buttons and the recent SDK log.

## 7. Ship it

1. Build your game (**File › Build Settings › Build**) and zip the build folder.
2. In the Creator dashboard, set the game's **download URL** (or storage path) and
   **executable path** (e.g. `MyCoolGame.exe`), then set visibility to **Public**.
3. Install and play it from the launcher. The launcher passes the player's secure session
   to your game automatically, times playtime, and shows the achievement popup over the
   game.

---

## Where next?

- **Stats** — `CoolGameXManager.AddStat("enemies_killed")`
- **Leaderboards** — `await CoolAPI.Leaderboards.Submit("high_score", score)`
- **Cloud saves** — `await CoolAPI.CloudSave.Save("slot1", mySave)`
- **DLC** — `await CoolAPI.DLC.Owns(Ids.DLC.Expansion)`

Want to try them all without writing code? Import the **SDK Playground** sample
(`Samples/AchievementTest/CoolGameXTester.cs`), drop it on a GameObject and press Play.

Full reference: [README](README.md) · https://coolgamex.com/sdk.html
