> 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/unity-plugin/adding-actions-to-your-character.md).

# Adding Actions to your Character

Follow the retained legacy Unity action workflow for existing projects and find the current Convai Unity SDK character actions guide for migration.

This page preserves the legacy Unity action workflow for projects that still use the older Convai integration.

{% hint style="warning" %}
**Deprecated on August 26, 2026.** Use [Character actions](/api-docs/plugins-and-integrations/convai-unity-sdk/features/character-actions.md) in the current Convai Unity SDK documentation. This page remains available for projects that have not migrated.
{% endhint %}

## Setting Up Action Configurations

1. Select the Convai NPC character from the hierarchy.
2. Scroll down to the ConvaiNPC script attached to your character.
3. Click the "Add Component" button.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fb06DsiOiHzNt8yLiXhVe%2Fimage.png?alt=media&amp;token=f511980d-6b14-45b8-a339-b0c51d1c3f32" alt="Unity Inspector with the Add Component control for the selected character" width="438"><figcaption></figcaption></figure>

4. Use the checkbox to add the action script to the NPC Actions.
5. Click "Apply Changes" to confirm.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FfDgdUhcTl2aIFHfrvInd%2Fimage.png?alt=media&amp;token=88ed20a6-f14d-429e-b6be-5a00a360f6e5" alt="Legacy NPC Actions setup with the action script selected" width="563"><figcaption></figcaption></figure>

## Pre-defined Actions

Convai offers predefined actions for a quick start.

1. Click the "+" button to add a new action.
2. From the dropdown menu, select "Move To."

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FqeGC7yKbbge4o5HuRLzF%2Fimage.png?alt=media&amp;token=f95b2865-ea80-4e90-b185-ec289c8227a1" alt="Legacy action configuration dropdown with Move To selected"><figcaption></figcaption></figure>

3. Enter the action name as "Move To" (the name doesn't have to match the action choice name).
4. Leave the Animation Name field empty for now.

Repeat these steps to add more actions like "Pickup" and "Drop" etc.

### Adding an Object in the Scene

1. Add any object into the scene—a sphere, a cube, a rock, etc.—that can be interacted with
2. Resize and place the object in your scene.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FdaYRkOuVDOH5fCCjKf3H%2Fimage.png?alt=media&amp;token=a3ccc56f-05a2-43b7-80c2-d979e5858b48" alt="An interactable object placed in the Unity scene"><figcaption></figcaption></figure>

### Adding the Convai Interactables Data Script

* Create an empty GameObject and name it "Convai Interactables."
* Attach the Convai Interactables Data script to this GameObject.
* Add characters and objects to the script by clicking the "+" button and attaching the corresponding GameObjects.

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FeozeOhx4vjvOAoHA6ydg%2Fimage.png?alt=media&amp;token=a19125de-bccd-451f-85de-b310736ccb03" alt="Legacy Convai Interactables Data component with character and object lists"><figcaption><p>Convai Interactables Setup</p></figcaption></figure>

* Add the "There" object in Objects list, so that we can use the Dynamic Move Target indicator.<br>

  <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F4sKwUATtSeYDQ2zuCbvv%2Fimage.png?alt=media&amp;token=7841f472-ec46-49f2-9087-93d5f266355a" alt="There object added to the legacy interactable objects list"><figcaption></figcaption></figure>
* Add the [Dynamic Move Target Indicator](#adding-a-dynamic-move-target-indicator) and setup [NavMesh agent](#setting-up-navmesh) to you NPC.

### Setting Up NavMesh

To ensure your NPCs can navigate the scene:

1. **Bake a NavMesh** for your scene if you haven't already:
   * Go to **Window > AI > Navigation**.
   * In the **Navigation** window, under the **Bake** tab, adjust the settings as needed.
   * Click **"Bake"** to generate the NavMesh.
2. Ensure that the NPC character has a **NavMeshAgent** component:

   * If not already attached, click **"Add Component"** and search for **NavMeshAgent**.
   * Adjust the **Agent Radius, Speed,** and other parameters according to your NPC's requirements.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FBkCZTRp7by9bCs0mDAo6%2Fimage.png?alt=media&amp;token=056817c4-dc1c-49cc-9cb0-ebda17ff67f9" alt="NavMeshAgent settings on the legacy Convai character"><figcaption></figcaption></figure>

### Adding a Dynamic Move Target Indicator

To visually indicate where your NPC will move:

* Create a new empty GameObject in the scene and name it accordingly or use the pre-made prefab named **Dynamic Move Target Indicator.**
* Link this **Move Target Indicator** to your NPC's action script so it updates dynamically when you point the cursor to the ground and ask the NPC to move to "There".

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FISOT45TZnSaq6QVxdAvn%2Fimage.png?alt=media&amp;token=5af4dea9-c89b-49e4-b226-06f4d7f80864" alt="Dynamic Move Target Indicator positioned in the Unity scene"><figcaption></figcaption></figure>

### Test the Setup

1. Click "Play" to start the scene.
2. Ask the NPC, "Bring me the Box."
3. If setup properly, the NPC should walk upto the box and bring it to you

{% hint style="warning" %}
This feature is currently experimental and can misbehave. Feel free to try it out and leave us any feedback.
{% endhint %}

## Adding Custom Actions to Your Unity NPC in Convai

### Create an animation action

Make your NPC perform custom actions like dancing.

### Action that Only Requires an Animation

1. Locate the dance animation file within our plugin.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FcV6kdXXF9MBgQhd3Qs9E%2Fimage.png?alt=media&amp;token=73e6cffa-4185-4424-b3b4-914e1078e51f" alt="Dance animation asset selected in the Unity Project window"><figcaption></figcaption></figure>
2. Incorporate this animation into your NPC's actions.

### Setting Up the Animator Controller

1. Open the Animator Controller from the Inspector window.
2. Drag and drop the dance animation onto the controller, creating a new node named "Dancing."

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FZhDi7oDCUWqNW9EBO4ra%2Fimage.png?alt=media&amp;token=f02bfe87-d7df-4931-8b9b-9815a03a90c2" alt="Animator Controller with a Dancing animation state"><figcaption></figcaption></figure>

### Adding custom Animation Action

1. Go to the Action Handler Script attached to your Convai NPC.
2. Add a new action named "Dancing."
3. In the Animation Name field, enter "Dancing" (it must exactly match the Animator Controller node name).
4. Leave the enum as "None."

<figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FHC7yf3x78rEu3THtdAhh%2Fimage.png?alt=media&amp;token=32912565-538d-496f-ba04-9c24ee37b400" alt="Legacy action handler configured with a Dancing action"><figcaption></figcaption></figure>

### Testing the Custom Action

1. Click "Play" to start the scene.
2. Instruct the NPC, "Show me a dance move," and the NPC should start dancing.

## Creating Complex Custom Actions in Unity with Convai: Throwing a Rock

### Define the throwing action

Adding advanced custom actions, such as a throw action, to your NPC.

### Animation Requirement

1. Grab a [throw animation from Mixamo](https://www.mixamo.com/#/?page=1\&query=throw) or anywhere you like.
2. Import it into Unity.

### Setting Up the Animator Controller

1. Drag and drop the throw animation onto the controller, creating a new node named "Throwing." (Follow steps in [#action-that-only-requires-an-animation](#action-that-only-requires-an-animation "mention"))

### Action Handler Script Setup

1. Add the "Throw" enum to the script.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FdNNjyI4ZVIAvAyZAFfJ4%2Fimage.png?alt=media&amp;token=45926fa9-7e05-49ee-b2c5-f501b8c367f1" alt="Legacy action handler source with a Throw enum entry"><figcaption></figcaption></figure>
2. In the "Do Action" function, add a switch case for the throw action.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fbk2UBgs2ot79NGbptxXO%2Fimage.png?alt=media&amp;token=6153a10b-c6c6-4b0f-8e81-cfe336fc09b2" alt="Legacy Do Action switch with a Throw case"><figcaption></figcaption></figure>
3. Define the "Throw()" function.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2F4Cz4i2y6R1pKHsf50Oiy%2Fimage.png?alt=media&amp;token=29f8862f-b09f-4dfb-8260-1deab56a8e52" alt="Legacy action handler source defining the Throw function"><figcaption></figcaption></figure>

### Adding the Throw Action

1. Add a new action named "Throw" and select the "Throw" enum.
2. Leave the animation name field empty.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2FiyNDJKCtVq7N6nyI76jH%2Fimage.png?alt=media&amp;token=37c69fc0-f416-4e63-899c-02de2efcb824" alt="Legacy action configuration with the Throw action selected"><figcaption></figcaption></figure>

### Adding the Object (Rock) to the Convai Interactables Data script

1. Add any rock prefab into the scene.
2. Add the rock to the Convai Interactable Data script.

### Adding a location to Convai Interactables Data script

1. Add a stage/new location in the ground of the scene.
2. Add that new location game object in the Convai Interactable Data.

   <figure><img src="https://413558230-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEtUJA212Zc1S9ACc8T4l%2Fuploads%2Fx410GNfL2FwSLk728tpt%2Fimage.png?alt=media&amp;token=6f8aa815-d1e2-45e1-8b82-3400da01656b" alt="Stage location added to the legacy interactable objects list"><figcaption></figcaption></figure>

### Testing the Complex Action

1. Click "Play" to start the scene.
2. Instruct the NPC, "Pick up the rock and throw it from the stage."
3. If everything is set up properly, the NPC should pick up the rock and throw it from the stage.

***


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.convai.com/api-docs/plugins-and-integrations/unity-plugin/adding-actions-to-your-character.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
