This guide will walk you through setting up the NPC to NPC conversation feature in the Convai SDK.
Go to your Convai NPCs:
Select the NPCs you want to include in the conversation.
Enable Group NPC Controller:
Click on the Group NPC Controller
checkbox in the inspector panel.
Click Apply Changes
to add the group NPC controller script.
Create or Find the Speech Bubble Prefab:
Create a new speech bubble prefab or use the one provided in the Prefabs
folder.
Attach Required Components:
Add the speech bubble prefab and the player transform (optional, defaults to the main camera if not provided).
Set the conversation distance threshold variable (set it to zero to disable this feature, meaning NPC to NPC conversations will always happen regardless of the player’s distance).
Add Relevant Components:
Add components like lip sync, eye and head tracking, character blinking, etc., to the Convai NPC.
Create an NPC To NPC Manager GameObject:
Add an empty GameObject and rename it to NPC to NPC Manager
(optional).
Add the NPC2NPC Conversation Manager Script:
Attach the NPC2NPCConversationManager
script to the GameObject.
Configure the NPC Group List:
In the NPC Group List
, click on the +
icon to add a new list element.
Add the NPCs you want to include in the group conversation.
Set the group discussion topic.
Post configuration of NPCs
Bring the NPCs close together
Play the to make sure everything is working as intended.
By following these steps you can set up and manage NPC to NPC conversations in your Convai-powered application. For further customization and integration, refer to the complete implementation code and adjust it as needed for your specific use case.