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 |
---|---|
Events | The ConversationEvents of this component. |
Properties
Property | Description |
---|---|
Event | Gets the ConversationEvents. |
ConversationID | Gets the conversation ID. It'll create one if not exist. |
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. |
SelectingMethod | Returns the current Character Selecting Method. If no method is set returns Manual. |
API
Function | Description | Parameters |
---|---|---|
StartNewConversation | Start a new conversation. In Unity SDK by default, we only use one single conversation for handling all the characters. But it's able to handle multiple conversations by developers. To do so, save those conversation ID and use them correspondingly. | conversationID: if set, Inworld will start/resume with that conversation. |
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. |
UnregisterAll | Remove all the characters from the character list. |