LogoLogo
PlaygroundVideosBlogPricing
  • Welcome
  • Convai Playground
    • Playground Walkthrough
    • Get Started
    • Character Creator Tool
      • Create Character
      • Language and Speech
      • Knowledge Bank
      • Personality and Style
      • State of Mind
      • Memory
      • Actions
      • Narrative Design
      • Character Versioning
    • F.A.Q
  • Plugins & Integrations
    • Introduction
    • Unity Plugin
      • Pre-Requisites
      • Compatibility
      • Downloads
        • Limitations of WebGL Plugin
      • Setting Up Unity Plugin
      • Troubleshooting Guide
        • Disable Assembly Validation
        • Missing Newtonsoft Json
        • Microphone Permission Issues
        • Default Animations Incompatibility
        • Animations have Facial Blendshapes
        • Jaw Bone in Avatar is not Free
        • macOS Permission Issues
      • Creating a Convai Powered Scene from Template
      • Importing Ready Player Me (RPM) Characters
      • Importing Custom Characters
      • Adding Actions to your Character
      • Adding Lip-Sync to your Character
      • Adding Narrative Design to your Character
        • Narrative Design Keys
      • Adding NPC to NPC Conversation
      • Adding Scene Reference and Point-At Crosshairs
      • Utilities
        • Character Emotion
        • Player Data Container
        • Long Term Memory
        • Language Support
        • Managing sessionID Locally
        • Transcript UI System
        • Pre-built UI Prefabs
        • Input Management
        • Notification System
        • Settings Panel
        • Dynamic Information Context
      • Building For Supported Platforms
        • Building for iOS/iPadOS
        • Building for WebGL
        • Convai XR
          • Building for VR
            • VR Automatic Installation
            • VR Manual Installation
          • Building for MR
            • MR Automatic Installation
            • MR Manual Installation
          • Building for AR
          • Interacting with XR UI Elements
        • Building for macOS Universal apps
      • Changelogs
      • Tutorials
        • Narrative Design
        • NPC2NPC
    • Unreal Engine
      • Supported Platforms
      • Installation
      • Guides
        • Dynamic Environment Info
        • Change AI Character Movement Speed
        • Integration with Pixel Streaming
        • Adjust Interaction Radius
        • Creating MetaHuman Characters
          • Adding MetaHuman
          • Adding LipSync to MetaHuman (From plugin version 3.0.0 or later )
          • Change the Parent Class for MetaHuman
          • Change the parent class for Player.
          • Adding LipSync to MetaHuman (Deprecated)
        • Creating ReadyPlayerMe Characters
          • Download Plugins
          • Adding ReadyPlayerMe Character
          • Change the parent class for Player.
        • Creating Reallusion Characters
          • Creating a Reallusion Character
          • Importing Reallusion character and setting up the Convai plugin
          • Binding objects to Reallusion Character
        • Event-Aware Convai Characters
        • Operations Based on the Presence of Certain Words
        • Narrative Design
          • Narrative Design Trigger
          • Narrative Design Keys
        • Actions Guide
          • Stage 1: Default Actions
            • Moves To
            • Follows
          • Stage 2: Custom Actions
            • Simple actions
            • Adding Descriptions to Actions
          • Stage 3: Custom Actions with Single Parameter
          • Main Character and Attention Object
        • Customization
          • Push to Talk
          • Alter Character Response Audio Rate
        • Speech To Text Transcription
        • Enable Multiplayer Support
        • 3D Chat Widget
        • Long Term Memory
        • Saving and Loading Session
      • Blueprints Reference
        • Convai Player
        • Convai Chatbot
        • Convai Environment
        • Convai Object Entry
        • Convai Result Action
        • Convai Extra Params
        • Speech To Text
        • Text To Speech
        • Utility Functions
      • Troubleshoot Guide
        • Missing Unreal Engine Tool Set in Microsoft Visual Studio Toolchain
        • Convai Module Not Found
        • MetaHuman Plugin Conflict
        • Failure to Load Character IDs
      • Microphone Settings
        • Set Audio Gain
        • Set Microphone
        • Microphone test
        • List Microphone Devices
      • Mac Microphone Permission: Required for UE 5.0 and 5.3
      • Guides V2 (Under Development)
        • Getting Started
          • Installation
          • Simple Talking Cube
          • Adding Premade Chat and Settings UI
    • Web Plugin
      • PlayCanvas Plugin
        • Adding External Script
        • First Person View
        • Adding characters to scene
        • Character Animations
        • Convai Integration
        • Chat Overlay
      • Convai Web SDK
        • Getting Started
        • Facial Expressions
        • Actions
      • JavaScript Chat UI SDK
        • Getting Started
        • ChatBubble Props
      • Narrative Design Guide
        • Narrative Design Triggers
        • Narrative Design Keys
      • GLB Characters for Convai
      • GLB/FBX animations for Convai
    • Modding Framework
      • Modding Cyberpunk 2077
    • Other Integrations
      • Roblox
        • Sample Game 1
        • Sample Game 2
        • Code Example
          • Character Conversation API
      • Discord
        • Create a Discord Bot
        • Hosting Discord Bot from Personal Server
        • Hosting Discord Bot from Replit
      • Omniverse Extension
      • Third-Party API Integrations
        • ElevenLabs API Integration
  • Reference
    • Core API Reference
      • Character Base API
      • Interaction API
      • Core AI Setting API
      • Backstory API
      • Chat History API
      • Knowledge Bank API
      • Narrative Design API
      • Action API
      • Language List API
      • Voice List API
      • Character List API
      • Evaluation API
Powered by GitBook
On this page
  • Setting Up Action Configurations
  • Pre-defined Actions
  • Adding an Object in the Scene
  • Adding the Convai Interactables Data Script
  • Setting Up NavMesh
  • Adding a Dynamic Move Target Indicator
  • Test the Setup
  • Adding Custom Actions to Your Unity NPC in Convai
  • Introduction
  • Action that Only Requires an Animation
  • Setting Up the Animator Controller
  • Adding custom Animation Action
  • Testing the Custom Action
  • Creating Complex Custom Actions in Unity with Convai: Throwing a Rock
  • Introduction
  • Animation Requirement
  • Setting Up the Animator Controller
  • Action Handler Script Setup
  • Adding the Throw Action
  • Adding the Object (Rock) to the Convai Interactables Data script
  • Adding a location to Convai Interactables Data script
  • Testing the Complex Action

Was this helpful?

  1. Plugins & Integrations
  2. Unity Plugin

Adding Actions to your Character

Follow these instructions to enable actions for your Convai-powered characters.

PreviousImporting Custom CharactersNextAdding Lip-Sync to your Character

Last updated 8 months ago

Was this helpful?

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.

  1. Use the checkbox to add the action script to the NPC Actions.

  2. Click "Apply Changes" to confirm.

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."

  1. Enter the action name as "Move To" (the name doesn't have to match the action choice name).

  2. 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.

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.

  • Add the "There" object in Objects list, so that we can use the Dynamic Move Target indicator.

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.

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".

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

This feature is currently experimental and can misbehave. Feel free to try it out and leave us any feedback.

Adding Custom Actions to Your Unity NPC in Convai

Introduction

Make your NPC perform custom actions like dancing.

Action that Only Requires an Animation

  1. Locate the dance animation file within our plugin.

  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."

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."

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

Introduction

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

Animation Requirement

  1. 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 Handler Script Setup

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

  2. In the "Do Action" function, add a switch case for the throw action.

  3. Define the "Throw()" function.

Adding the Throw Action

  1. Add a new action named "Throw" and select the "Throw" enum.

  2. Leave the animation name field empty.

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.

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.


Add the and setup to you NPC.

Grab a or anywhere you like.

throw animation from Mixamo
Dynamic Move Target Indicator
NavMesh agent
Convai Interactables Setup