Skip to main content

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

VariableDescription
EventsThe ConversationEvents of this component.

Properties

PropertyDescription
EventGets the ConversationEvents.
ConversationIDGets the conversation ID.
It'll create one if not exist.
IsAnyCharacterSpeakingReturns true if any character is speaking.
CurrentCharacterNamesReturns the brain names of all InworldCharacters in the current conversation.
CurrentCharacterGets 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.
CurrentCharactersGets the current interacting characters in the group.
If set, it'll also start audio sampling if ManualAudioHandling is false, and invoke the event OnCharacterChanged.
SelectingMethodReturns the current Character Selecting Method. If no method is set returns Manual.

API

FunctionDescriptionParameters
StartNewConversationStart 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.
ChangeSelectingMethodChange the method of how to select character.
GetCharacterByBrainNameGets the InworldCharacter by any brain name.
May return null if not found.
brainName: target brain Name to send.
GetCharacterByGivenNameGets 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.
RegisterAdd a InworldCharacter to the character list.
Triggers OnCharacterListJoined
InworldCharacter: target character to add.
UnregisterRemove the character from the character list.
If it's current character, or in the group chat, also remove it.
InworldCharacter: target character to remove.
UnregisterAllRemove all the characters from the character list.