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

# DeviceManager

> Headset activation, device checks, and org content fetch for managed deployments.

**Folder:** `Assets/_MolcaSDK/_VR/Scripts/Device Manager/`\
**Namespace:** `MolcaSDK.VR.DeviceManager`\
**Type:** [RuntimeSubsystem](/core/runtime-subsystem) on [RuntimeManager](/core/runtime-manager)

## When to use

Use **`DeviceManager`** for **kiosk / managed headset** flows: **check or activate** a device against your backend, then **`FetchContent`** to deserialize **`ContentResponse`** into **[Scenario Data Config](/setup/scenario-data-config)** via **`SetFetchedContent`**. Pair with **`DeviceCheck`** as [IPreloadCheck](/shared/preload-checks) so loading waits until the device is valid.

**`OrganizationId`** is exposed for session logic; set explicitly with **`SetOrganizationId`** when your activation flow provides it ([Scenario session](/vr/session-loading-and-events) reads org context when present).

## Inspector setup

| Field                    | Purpose                                                                   |
| ------------------------ | ------------------------------------------------------------------------- |
| **Device check request** | `HttpRequestAsset` — **`CheckDevice()`**                                  |
| **Device code request**  | `HttpRequestAsset` — **`ActivateDevice(code)`** sets JSON body `{ code }` |
| **Get content request**  | `HttpRequestAsset` — **`FetchContent()`** after success paths             |

All calls use **`SendAsync()`** on the assets; configure base URL / headers per [HttpClient](/core/http-client) / asset defaults.

## Code

```csharp theme={null}
using Molca;
using MolcaSDK.VR.DeviceManager;

public static async Awaitable<bool> RunDeviceGate()
{
    var dm = RuntimeManager.GetSubsystem<DeviceManager>();
    if (dm == null)
        return false;

    bool ok = await dm.CheckDevice();
    if (!ok)
    {
        var act = await dm.ActivateDevice("USER-ENTRY-CODE");
        ok = act.isSuccess;
    }
    return ok;
}
```

After **`CheckDevice`** or successful **`ActivateDevice`**, the manager awaits **`FetchContent()`** internally (see source).

## API (key members)

| Member                                | Description                                                          |
| ------------------------------------- | -------------------------------------------------------------------- |
| **`DeviceStatus`**                    | Static enum: NotActive / Active / Error                              |
| **`OrganizationId`**                  | String; use **`SetOrganizationId`**                                  |
| **`CheckDevice()`**                   | `Awaitable<bool>` — sets status, calls **`FetchContent`** on success |
| **`ActivateDevice(string code)`**     | Posts code; on success, **`FetchContent`**                           |
| **`FetchContent()`**                  | GET content; maps to **`ScenarioDataConfig`**                        |
| **`SetOrganizationId(string orgId)`** | Manual org assignment                                                |

## Troubleshooting

* **Always `Error` status** — Inspect **`HttpResponse`** from activation/check in debugger; verify **`HttpRequestAsset`** endpoints and device API contract.
* **Home list still empty after success** — **`FetchContent`** must succeed and return JSON that deserializes to **`ContentResponse`**; confirm **`ScenarioDataConfig`** instance exists in scene/project.
* **`ScenarioSessionManager.OrgId` null** — **`OrganizationId`** is only set if your flow calls **`SetOrganizationId`** or you extend **`DeviceManager`** to parse org from responses (current sample code leaves it to explicit setter).
* **Race with preload** — Ensure **DeviceCheck** preload runs before UI that reads **`ScenarioDataConfig`**.

## Related

* [Preload checks](/shared/preload-checks) — **`DeviceCheck`** / **`IPreloadCheck`**
* [Scenario Data Config](/setup/scenario-data-config) — **`SetFetchedContent`**
* [Session loading & events](/vr/session-loading-and-events) — org / content timing
* [HttpRequestAsset](/core/http-client) — request assets

## Unity Editor

<Frame hint="DeviceManager component on prefab or bootstrap object; or Device Check UI in scene." caption="DeviceManager / device activation UI">
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/ptmolcateknologinusantara/images/features/vr/device-manager-inspector.png" alt="DeviceManager in Unity Inspector or device check UI" />
</Frame>
