Skip to main content

InworldController

The InworldController is the main controller. It is a singleton gameObject. Please ensure that there is only one InworldController in the scene.

InworldController

Inspector Variables

VariableDescription
Auto StartSet to True if you want to immediately load the scene once a run-time token is acquired
DataThe InworldSceneData that is being loaded
Inworld PlayerThe Player Controller that the InworldCharacters are communicating with
CaptureThe AudioCapture(Microphone Manager) that is being used

Events

EventTypeDescription
OnStateChangedAction<ControllerStates>Triggered on a status change
OnPacketReceivedAction<InworldPacket>Triggered on the receival of InworldPackets
OnCharacterChangedAction<InworldCharacter, InworldCharacter>Triggered whenever the highest priority InworldCharacter is changed

Properties

PropertyTypeDescription
IsCapturingboolGet/Set audio recording. Can only be used when audio capture has been established (StartAudioCapture is called).
AutoStartboolGets or sets at AutoStart. The Inworld Controller would immediately start the session once the token is received if Auto Start is checked
CurrentSceneInworldSceneDataGets or sets the current scene data
PlayergameObjectGets or sets the current Player Controller
CurrentCharacterInworldCharacterGets or sets the current InworldCharacter. Usually, it is set by CheckPriority()
CharactersList<InworldCharacter>Gets or sets all the characters that the InworldScene contains
HasInitboolChecks if the run-time session token has been received and if the client has been initialized
StateControllerStatesGets or sets the controller's current state. Once the state has been set, its OnStateChanged event will be invoked
IsValidboolChecks if all the data is correct

API

FunctionReturn TypeDescriptionParameters
InitvoidInitializes the SDK. Ensure that there is a valid ServerConfig (i.e., it has a valid URI for both the RuntimeServer and StudioServer) and a valid API Key and API SecretN/A
LoadCharacterSystem.Threading.Tasks.TaskStarts a session with the target InworldCharacter. If the session is successful, then this will create a default session for that character with a valid SessionKey and AgentID.character: A gameObject or prefab that has an InworldCharacter Component.
LoadSceneSystem.Threading.Tasks.TaskStarts a session with the target InworldSceneData. If the session is successful, then this sets the current InworldSceneData to the new one, with a valid SessionKey and a list of its InworldCharacter with valid AgentIDs.inworldSceneData: The InworldScene to load.
DisconnectSystem.Threading.Tasks.TaskDisconnects and ends any server-based NPC interactionsN/A
SendEventvoidSends an InworldPacket to our serverpacket: InworldPacket to send
StartAudioCapturevoidStarts communicating with the target character via audiocharacterID: A string representing the character ID. It is generated after the InworldScene is loaded and the session is started
EndAudioCapturevoidStop communicating with the target character via audiocharacterID: A string representing the character ID. It is generated after the InworldScene is loaded and the session is started
RegisterCharactervoidCalled by InworldCharacter to register them into InworldController's character listcharacter: The InworldCharacter to add
GetFirstChildInworldCharacterGet the first attached InworldCharacterisActive: if it's true, returns first active InworldCharacter, else return the first inactive InworldCharacter