> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/plugins-and-integrations/convai-unity-sdk/features/long-term-memory/configure-memory-for-a-character.md).

# Configure memory for a character

Long-term memory is disabled by default (`MemorySettings.IsEnabled = false`). No facts are extracted or stored until you explicitly enable it. You can enable or disable memory through the Convai dashboard or programmatically via `client.Characters`.

{% hint style="danger" %}
**Memory settings apply globally to the character.** Enabling LTM for a character affects every application, SDK version, and deployment that connects to that character ID. If you share a character across development, staging, and production environments, enabling memory in one environment enables it in all of them. Coordinate with your team before enabling on a shared character.
{% endhint %}

***

### Enable or disable memory

{% tabs %}
{% tab title="Dashboard" %}
This is the recommended approach for most teams. Changes take effect immediately without requiring a code update or redeployment.

1. Sign in at [convai.com](https://convai.com).
2. Open the character you want to configure.
3. Select the **Memory** tab in the character's settings sidebar.
4. Toggle **Long-Term Memory** to **On**.
5. Click **Save**.

To disable, repeat the same steps and toggle **Long-Term Memory** to **Off**.
{% endtab %}

{% tab title="Scripting" %}
Use `client.Characters` when you need programmatic control — for example, in automated test setups, build pipelines, or runtime admin panels.

**Check current state**

```csharp
using Convai.RestAPI;
using UnityEngine;

public class MemoryAdmin : MonoBehaviour
{
    private async void Start()
    {
        using var client = new ConvaiRestClient(ConvaiSettings.Instance.ApiKey);

        bool isEnabled = await client.Characters.GetMemoryEnabledAsync("your-character-id");
        Debug.Log($"LTM enabled: {isEnabled}");
    }
}
```

**Enable memory**

```csharp
using Convai.RestAPI;
using UnityEngine;

public class MemoryAdmin : MonoBehaviour
{
    private async void Start()
    {
        using var client = new ConvaiRestClient(ConvaiSettings.Instance.ApiKey);

        await client.Characters.SetMemoryEnabledAsync("your-character-id", true);
        Debug.Log("Long-term memory enabled.");
    }
}
```

**Disable memory**

```csharp
await client.Characters.SetMemoryEnabledAsync("your-character-id", false);
```

{% endtab %}
{% endtabs %}

***

### Disable memory without deleting records

{% hint style="warning" %}
Disabling LTM stops new memories from being extracted, but **does not delete existing memory records**. The stored facts remain on Convai and will be re-injected if you re-enable LTM later.

If you want to disable LTM and remove all stored memories, delete the memories first, then disable.
{% endhint %}

To purge all memories for a user–character pair before disabling, use `client.Memory.DeleteAllAsync` followed by `SetMemoryEnabledAsync`. `DeleteAllAsync` removes memories for one specific user–character pair. To remove all end-user records across all characters instead, use `client.EndUsers.DeleteAsync(endUserId)`. See [Manage end-user records](/api-docs/plugins-and-integrations/convai-unity-sdk/features/long-term-memory/end-user-management.md).

See [Long-term memory usage examples](/api-docs/plugins-and-integrations/convai-unity-sdk/features/long-term-memory/usage-examples.md) for a complete reset pattern.

***

### Next steps

{% content-ref url="/pages/GQgbZSFMOcRCBLwo1vqX" %}
[End-user identity](/api-docs/plugins-and-integrations/convai-unity-sdk/features/long-term-memory/end-user-identity.md)
{% endcontent-ref %}

{% content-ref url="/pages/09sxltM2pYC5cl7evTls" %}
[Manage end-user records](/api-docs/plugins-and-integrations/convai-unity-sdk/features/long-term-memory/end-user-management.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/plugins-and-integrations/convai-unity-sdk/features/long-term-memory/configure-memory-for-a-character.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
