InworldController
The InworldController is the main controller. It is a singleton gameObject
. Please ensure that there is only one InworldController
in the scene.
Inspector Variables
Variable | Description |
---|---|
Auto Start | Set to True if you want to immediately load the scene once a run-time token is acquired |
Data | The InworldSceneData that is being loaded |
Inworld Player | The Player Controller that the InworldCharacters are communicating with |
Capture | The AudioCapture(Microphone Manager) that is being used |
Events
Event | Type | Description |
---|---|---|
OnStateChanged | Action<ControllerStates> | Triggered on a status change |
OnPacketReceived | Action<InworldPacket> | Triggered on the receival of InworldPackets |
OnCharacterChanged | Action<InworldCharacter, InworldCharacter> | Triggered whenever the highest priority InworldCharacter is changed |
Properties
Property | Type | Description |
---|---|---|
IsCapturing | bool | Get/Set audio recording. Can only be used when audio capture has been established (StartAudioCapture is called). |
AutoStart | bool | Gets or sets at AutoStart. The Inworld Controller would immediately start the session once the token is received if Auto Start is checked |
CurrentScene | InworldSceneData | Gets or sets the current scene data |
Player | gameObject | Gets or sets the current Player Controller |
CurrentCharacter | InworldCharacter | Gets or sets the current InworldCharacter. Usually, it is set by CheckPriority() |
Characters | List<InworldCharacter> | Gets or sets all the characters that the InworldScene contains |
HasInit | bool | Checks if the run-time session token has been received and if the client has been initialized |
State | ControllerStates | Gets or sets the controller's current state. Once the state has been set, its OnStateChanged event will be invoked |
IsValid | bool | Checks if all the data is correct |
API
Function | Return Type | Description | Parameters |
---|---|---|---|
Init | void | Initializes 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 Secret | N/A |
LoadCharacter | System.Threading.Tasks.Task | Starts 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. |
LoadScene | System.Threading.Tasks.Task | Starts 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 AgentID s. | inworldSceneData: The InworldScene to load. |
Disconnect | System.Threading.Tasks.Task | Disconnects and ends any server-based NPC interactions | N/A |
SendEvent | void | Sends an InworldPacket to our server | packet: InworldPacket to send |
StartAudioCapture | void | Starts communicating with the target character via audio | characterID: A string representing the character ID. It is generated after the InworldScene is loaded and the session is started |
EndAudioCapture | void | Stop communicating with the target character via audio | characterID: A string representing the character ID. It is generated after the InworldScene is loaded and the session is started |
RegisterCharacter | void | Called by InworldCharacter to register them into InworldController's character list | character: The InworldCharacter to add |
GetFirstChild | InworldCharacter | Get the first attached InworldCharacter | isActive: if it's true, returns first active InworldCharacter, else return the first inactive InworldCharacter |