CharacterHandler
Module: Inworld.AI. Namespace: Inworld.
This component is part of the InworldController prefab and is responsible for selecting the character with whom the current player is interacting.
Inspector Variables
Variable | Description |
---|---|
Manual Audio Handling | If checked, developers need to manually call InworldController.Instance.StartAudio() to initiate microphone recording. By default, this option is set to false. |
Events
Event | Description |
---|---|
OnCharacterListJoined | Triggered when an InworldCharacter joins the current conversation. The parameter is the InworldCharacter gameObject. |
OnCharacterListLeft | Triggered when an InworldCharacter leaves the current conversation. The parameter is the InworldCharacter gameObject. |
Properties
Property | Description |
---|---|
IsAnyCharacterSpeaking | Returns true if any character is speaking. |
CurrentCharacterNames | Returns the brain names of all InworldCharacters in the current conversation. |
CurrentCharacter | Gets or sets the currently interacting character. Note: This is provided for backwards compatibility. Although you are allowed to talk to multiple characters, sometimes you need to nominate a primary character without unregistering others. This parameter will overwrite the group chat CurrentCharacters. |
CurrentCharacters | Gets the current interacting characters in the group. If set, it'll also start audio sampling if ManualAudioHandling is false, and invoke the event OnCharacterChanged. |
ManualAudioHandling | If set to false, the AudioCapture of the InworldController will automatically start recording the player's voice when at least one character is selected. Otherwise, developers need to manually call InworldController.Instance.StartAudio() to initiate the microphone. |
SelectingMethod | Returns the current Character Selecting Method. If no method is set returns Manual. |
API
Function | Description | Parameters |
---|---|---|
ChangeSelectingMethod | Change the method of how to select character. | |
GetCharacterByBrainName | Gets the InworldCharacter by any brain name. May return null if not found. | brainName: target brain Name to send. |
GetCharacterByGivenName | Gets the first InworldCharacter by the given name. May return null if not found. If multiple characters have the same name, it'll return the first one. | brainName: target brain Name to send. |
Register | Add a InworldCharacter to the character list. Triggers OnCharacterListJoined | InworldCharacter: target character to add. |
Unregister | Remove the character from the character list. If it's current character, or in the group chat, also remove it. | InworldCharacter: target character to remove. |