Skip to main content

InworldCharacter

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

InworldCharacter

Inspector Variables

VariableDescription
DataThe InworldCharacterData for this character
Audio InteractionThe character's AudioInteraction
Current AvatarThe character's Animator
Sight AngleThe character's field of view, displayed in Gizmos
Sight DistanceThe character's sight distance, displayed in Gizmos
Sight Refresh RateHow often the characters are calculating priority

Properties

PropertyTypeDescription
DataInworldCharacterDataReturns InworldCharacterData
IDstringReturns the ID for the character. The ID or CharacterID field will be generated only after LoadingScene() is successful
CharacterNamestringThe display name for the character. Note that CharacterName may not be unique
BrainNamestringThe BrainName for the character. Note that BrainName is actually the character's full name, formatted like workspace/xxx/characters/xxx. It is unique
IsValidboolReturns True if the character has InworldCharacterData
HasRegisteredLiveSessionboolChecks if this InworldCharacter has been registered in the live session
PriorityfloatReturns the priority of the character. The higher the priority is, the more likely the character is to respond to the player
CurrentAudioRemainingTimefloatReturns the remaining time for the character's audioClip. This data will be modified by AudioInteraction
EventInteractionEventReturns the Unity Event of Interaction
AudioAudioInteractionGets or sets the character's AudioInteraction.
CurrentAvatargameObjectGets or sets the model it is bound to
EmotionstringGet the current emotion (last emotion received from server) of the character.
GesturestringGet the current gesture (last gesture received from server) of the character.

API

FunctionReturn TypeDescriptionParameters
LoadCharactervoidLets an InworldCharacter bind data. This model can be of any kind (e.g., even a cube). If the input model is null, then it will download a model and attach to it whenever it has a valuable modelUri. Otherwise, it will attach to the default avatar.incomingData: The InworldCharacterData to bind to model: The model to bind to
ResetCharactervoidResets the history items for a character and performs audio cache clean-upN/A
SendTextvoidSends text to the character via a InworldPackettext: the text to send
SendTriggervoidSend target character's trigger via InworldPacket.triggerName: The trigger to send. Both formats are acceptable. You could send either whole string from CharacterData.trigger, or the trigger's shortName.
SendEventToAgentvoidSends general events to the characterpacket: The InworldPacket to send