- Home /
One text box after another
This seems like a silly question to ask as it's most likely really simple to do.
Basically I'm wanting to have multiple text boxes come up, one after the other like as if someone is talking to you with the ability for when the user presses a button, it will skip to the next text box. I've already done all the coding for the test boxes and I'm able to input text and even have it type one letter at a time but I just can't seem to think of a way to get it so one text box comes after another like a discussion. Without of course adding tons of booleans to check if the character has already said something.
I was wondering if someone has an idea on how I can this?
Answer by ComradeVanti · Mar 05, 2016 at 04:04 PM
Codelyoko363
You could try something like this:
private TextBox activeBox = null;
public TextBox[] allTextBoxes;
private int index = 0;
void OnPlayerPressesButton() {
index++;
activeBox = allTextBoxes [index];
}
The Array allTextBoxes contains allTextBoxes you want to show. By calling OnPlayerPressesButton() you can cycle through the TextBoxes and set the activeTextBox witch would be displayed on screen.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Unity 2D - Text UI and Textbox scripting issue - HELP ASAP! 2 Answers
One Text box after another problem 1 Answer