Skip to main content

InworldCharacter

Module: Inworld.AI. Namespace: Inworld. Inherited from MonoBehavior RequireComponent: InworldInteraction.

This script implements the Inworld Character that players can communicate with.

InworldCharacter

Inspector Variables

VariableDescription
DataThe InworldCharacterData associated with this character.
CharacterEventsAll the CharacterEvents from this character.
Verbose LogCheck to enable more detailed logging for this character in the console.

Properties

PropertyDescription
EventsGets the Unity Events of the character.
AnimatorGets the character's animator.
IsSpeakingGets or sets whether this character is currently speaking.
CurrRelationGets or sets the character's current relationship with players. This will invoke the onRelationUpdated event when set.
DataGets or sets the InworldCharacterData.
If set, it will also assign the live session ID to the character's InworldInteraction component.
NameGets the display name of the character. Note that the name may not be unique.
BrainNameGets the character's BrainName.
Note that the BrainName is actually the character's full name, formatted as workspace/xxx/characters/xxx.
It is unique.
IDGets the live session ID of the character.
If not registered, it will attempt to fetch one from the InworldController's CharacterHandler.
PriorityReturns the priority of the character.
the character with the highest priority is more likely to respond than characters with lower priority.

API

FunctionDescriptionParameters
GetLiveSessionIDRegister the character in the character list.
Get the live session ID for an Inworld character.
SendTextSend a message to this character.text: The message to send.
SendNarrativeSend a narrative action to this character.narrative: The narrative text to send.
SendTriggerSend a trigger to this character.
The trigger is defined in the character's goals section in Inworld Studio.
trigger: The name of the trigger.
needCancelResponse: If checked, this sending process will interrupt the character's current speech.
parameters: The parameters and values of the trigger.
EnableGoalEnable the specified goal for this character.
By default, all goals are already enabled.
goalName: The name of the goal to enable.
DisableGoalDisable the specified goal for this character.goalName: The name of the goal to disable.
CancelResponseInterrupt the current character's speech, ignoring all incoming messages from the character.