Skip to main content

Demo: Multiple Characters

1. Opening the Sample Scene

In the Project Panel, click Assets > Inworld.AI > Scenes > SampleMultiCharacters to open the demo scene that supports multiple characters.

SampleMultiChar

2. Talking to the Characters

In the room, there are two characters: Hermes and Zeus. Once the connection is established, you can speak to them. Use the W A S D buttons on your keyboard to move forward, back, left, and right. You can speak to them directly using your microphone.

TalkMulti

3. Selecting a Character

Although multiple characters can be loaded into a single scene, you are still allowed to talk to one character at a time.

⚠️ Note: Additionally, we use a turn-based strategy to reduce server calls. Before ver 2.1.5, while a character is talking, you will not be able to switch to another character and talk to them until the current character has finished speaking.

The character that is currently selected is determined by their line of sight and where you are looking. In Editor Mode, you can adjust the angle and distance of their line of sight.

The blue lines show the areas where the Player Controller needs to be in order to be seen by the character. The red lines represent the angle between where you are looking and where the character is looking. If you are within the line of sight of multiple characters, the character with the narrowest red angle will be selected.

SelectChar

During runtime, the monitor will display which character you are currently talking to.

TalkingTo

⚠️ Note: Before version 2.1.5, this function was always activated and was set to call every 0.1 seconds in InworldController. After version 2.1.6, we have added a toggle for Auto Select Character. By default, it is turned on. If you turn it off, you will need to manually call InworldController.Instance.EndAudioCapture(LEGACY_CHARACTER_ID) first, and then InworldController.Instance.StartAudioCapture(TARGET_CHARACTER_ID) to switch to a different communicating character.

AutoSelect

4. Typing and Recording Text for Conversations

You can press the ~ button to open or close the text input panel during runtime. While the panel is open, you can view the history logs for all the characters in the scene and type or record sentences to the current selected character, but you can only communicate with the character that is currently selected.

MultiCharLog