---
title: View and manage state
product: Cloud Code
version: 3.1.0
latest_version: 3.1.0
status: This page documents version 3.1.0. The latest version is 3.1.0.
canonical: https://docs.unity.com/en-us/cloud-code/3.1.0/modules/stateful-cloud-code/view-and-manage-state
latest_url: https://docs.unity.com/en-us/cloud-code/3.1.0/modules/stateful-cloud-code/view-and-manage-state.md
last_updated: 2026-11-20
generated_at: 2026-11-21T13:52:16.254Z
locale: en-us
---

# View and manage state

> View, update, and clear the stored state of a player or multiplayer session from the Unity Dashboard or the Cloud Code Admin API.

Cloud Code stores state for each [scope](./state-scopes.md), whether that's a player or a multiplayer session. You can view and change a scope's state outside your game, for example to check a player's progress or to reset a session that no longer progresses.

## Manage state in the Unity Dashboard

To find a scope's state in the Unity Dashboard, follow these steps:

1. In the [Unity Dashboard](https://cloud.unity.com), select **Products**.
2. Select **Cloud Code**.
3. Select **C# Modules** > **State inspector**.
4. Select an environment.
5. Select **Multiplayer session** or **Player**.
6. Select a session ID or player ID, or enter the ID and select **Fetch**.

After you select or fetch a scope, the State inspector displays the scope's module state, with a row for each class, and its active timers.

To edit a class's state, follow these steps:

1. In the **Module state** section, expand the class's row to view its current state as JSON.
2. Select the pencil icon on the class's row.
3. Edit the JSON, then save your changes.

After you save your changes, the **Module state** section displays the class's updated state.

In the **Module state** section, select **Clear state** to clear all of the scope's module state. In the **Timers** section, select **Clear timers** to clear all of the scope's active timers.

## Manage state with the Cloud Code Admin API

Use the [Cloud Code Admin API](/oas-cloud-code-admin/1.0.0.md) to add the same workflow to your own tools. The API has an endpoint to get, update, and clear a scope's state.

To manage a scope's state with the Admin API, follow these steps:

1. [Authenticate with a service account](/services-web-apis/service-account-auth.md) that has the permission for the operation you want to perform:
   * Get module state: `cloud_code.modules.get`
   * Update module state: `cloud_code.modules.update`
   * Clear module state: `cloud_code.modules.delete`
2. Identify the scope type (`player` or `multiplayerSession`) and the player ID or session ID.
3. Call one of the following operations:
   * Get module state returns the state of each class as JSON, plus any active timers.
   * Update module state replaces the whole state of each class you send. It only changes the modules in the request, and you can't use it to change timers.
   * Clear module state removes the stored state, the active timers, or both.

After you call an operation, Get module state and Update module state return the scope's current state and its `ETag` value, and Clear module state returns a `204` response. If an operation returns a `404` error, the scope has no stored state yet. Cloud Code saves a module's state about a second after the module first runs for a player or session.

### Update limits

You can update a scope only if it already has stored state, so you can't use the API to create state for a scope that has never run.

You can't update the state of the following classes. Get module state lists them under `clearOnly` instead of `modules`, and you can only clear their state:

* Classes that use a custom `IStateSerializer`. For details, refer to [State serialization](./state-serialization.md).
* Classes removed from the deployed module.
* State that Cloud Code doesn't store as JSON.

To make sure an update doesn't overwrite changes made since you last read the state, send the `ETag` value from Get module state in the `If-Match` header of your update. If the state changed in the meantime, the update returns a `412` error and nothing changes.

## Additional resources

* [State scopes](./state-scopes.md)
* [State serialization](./state-serialization.md)
* [Timers in Stateful Cloud Code](./timers.md)
* [Cloud Code Admin API](/oas-cloud-code-admin/1.0.0.md)
* [Admin authentication](/services-web-apis/service-account-auth.md)
