- Home /
Creating a dialogue?
OK, here is the problem, i want to create a dialogue scene, where the player walks to an NPC, presses "E" and the NPC will speak at the bottom of the screen, much like subtitles.
function playSpeech1() : IEnumerator {
for (var letter in word.ToCharArray()) {
wordUI.text += letter;
yield WaitForSeconds(letterPause);
}
removeText();
}
function removeText() {
yield WaitForSeconds(4);
wordUI.text = "";
}
This is my current script which at the moment autotypes a String, when finished, removes the text.
Now the question is, how would i make a multi-string dialogue?
for example:
"Hello there"
//remove text
"How can i help you?"
//remove text
I'm not sure this is the most effective way, but is there an easier solutions, possibly considering an Array
Answer by SkaredCreations · Dec 17, 2014 at 11:27 AM
"word" should be an array and your current body of playSpeech1 should be enclosed within a "for" that loops through the array elements
Your answer
Follow this Question
Related Questions
BCE0048: Type 'boolean' does not support slicing. 1 Answer
TextAsset inside the Array - UnityScript/JavaScript 1 Answer
Sorting arrays? 1 Answer
How to delete new'd arrays? 2 Answers
what is the difference between a float[] and a float[,]? 1 Answer