Interactions Showcase
This room showcases interesting ways in which the player can interact with Inworld characters.
Custom Narrated Actions
The Custom Narrated Actions showcase is an example of how you can inject context into an interaction with an Inworld character by sending Narrated Actions.
This showcase utilizes Narrated Actions and Goals.
Sending Narrated Actions to an Inworld character in Unity is a straightforward process: (1) type your action into the designated input box, and (2) press Send
.
This sends your narrated action to the character and then triggers a response from Narrated Action Innequin.
public void SendNarratedAction()
{
if (string.IsNullOrEmpty(m_InputField.text)) return;
m_InworldCharacter.SendNarrative(m_InputField.text);
m_InworldCharacter.SendTrigger("narrated-action-comment");
}
goals:
- name: "narrated-action-comment"
repeatable: true
actions:
- instruction: "Comment on {player}'s narrated action."
activation:
trigger: "narrated-action-comment"
For more general information on Narrated Actions see Narrated Actions
For more information on using Narrated Actions with the Inworld Unity SDK, see the Sample2D demo scene.
Save Session
The Save Session showcase allows you to experiment with saving and loading previous conversation history.
In this showcase you can speak with Memory Innequin and utilize the Session Control panel to save and/or restart the session:
- Restart Session: Pressing this button disconnects the client from Inworld, refresh the Memory Innequin character and then reconnect with a new Live Session.
- Save: Pressing this button calls
InworldClient.GetHistoryAsync
which fetches the conversation history (of the current Live Session) from Inworld and stores it in theInworldClient.SessionHistory
string field. - Clear Saved Data: Pressing this button clears the
InworldClient.SessionHistory
string field, removing any session history data from local memory.
After calling InworldClient.GetHistoryAsync
the session history is then stored in InworldClient.SessionHistory
and is automatically loaded when a new session is started.
You can try testing saving and loading conversation history by asking Memory Innequin to remember something.
In the example below, Memory Innequin is asked to remember that the player's favorite color is blue. The conversation is then saved using the Save button as you can see by the timestamp on the Session Control panel:
If you then clear the saved data (by pressing Clear Saved Data) and restart the session (by pressing Restart Session) and ask Memory Innequin about the previous thing you asked them to remember, they should have no memory of this information.
If you do not clear the saved data and then restart the session, the character will remember and be able to relay that information. In this case, even though this is a new Live Session, Memory Innequin knows that the player's favorite color is blue from the loaded conversation history:
For more information on saving session history checkout the SampleConnection demo scene in the Unity SDK.