This repository was archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Text Input
Gersh Payzer edited this page May 23, 2018
·
2 revisions
The textbox control allows viewers to input text to your game.
In Interactive Studio, you can add a new Textbox by selecting the Textbox control and adding it to your project:
In Unity, there is both a polling style API that can be called from your Update function as well as an event-based API.
If you want to get text input from your game's update loop, you can write the following code:
if (MixerInteractive.HasSubmissions("MyTextBox"))
{
var results = MixerInteractive.GetText("MyTextBox");
foreach (InteractiveTextResult result in results)
{
string userWhoGuessed = result.Participant.UserName;
string guess = result.Text;
}
}
If you prefer you can also listen for text input through the OnInteractiveTextControl event.
MixerInteractive.OnInteractiveTextControlEvent += OnInteractiveTextControlEvent;
private void OnInteractiveTextControlEvent(object sender, Microsoft.Mixer.InteractiveTextEventArgs e)
{
string viewName = e.Participant.UserName;
string text = e.Text;
}