> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launcherforge.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Unity

> Validate LauncherForge launch tokens in a Unity game.

# Unity authentication

The LauncherForge Unity integration reads the launch token passed to the packaged game and validates the player session.

## Launch contract

The game is started with:

```text theme={null}
MyGame.exe --launchToken=TOKEN
```

The integration should process this value during application startup.

## Session result

The LauncherForge authentication session exposes:

```json theme={null}
{
  "id": "player-id",
  "email": "player@example.com",
  "valid": true
}
```

The `LauncherForge.LauncherAuth` namespace and `LauncherAuthSession` state can be used by your game UI or startup logic to react to progress and results.

## Recommended flow

<Steps>
  <Step title="Add the integration">
    Import the LauncherForge Unity package into the project.
  </Step>

  <Step title="Initialize on startup">
    Place the authentication startup component in a persistent bootstrap scene or object.
  </Step>

  <Step title="Observe the session state">
    Display a loading state while the token is read and validated.
  </Step>

  <Step title="Accept or reject the session">
    Enter the protected game flow only when `valid` is true.
  </Step>
</Steps>

## Development UI

A status panel can be limited to the Editor and Development Builds. Avoid exposing detailed authentication diagnostics in production unless they are appropriate for players.

## HTTPS requirement

Use an HTTPS validation endpoint in production. Unity can reject or warn about insecure HTTP requests depending on the build and player settings.

<Warning>
  Never embed private server credentials or administrative API keys in the Unity client.
</Warning>
