Hi, I’ve created a subtitle that writing words one after one, I’ve used my method for this but I think it isn’t the best way that I could do to create such a thing like that
This code will writing My Name Is Ash
yield WaitForSeconds (13);
yield WaitForSeconds (0.04);
guiText.text = "M";
yield WaitForSeconds (0.04);
guiText.text = "My";
yield WaitForSeconds (0.04);
guiText.text = "My N";
yield WaitForSeconds (0.04);
guiText.text = "My Na";
yield WaitForSeconds (0.04);
guiText.text = "My Nam";
yield WaitForSeconds (0.04);
guiText.text = "My Name";
yield WaitForSeconds (0.04);
guiText.text = "My Name I";
yield WaitForSeconds (0.04);
guiText.text = "My Name Is";
yield WaitForSeconds (0.04);
guiText.text = "My Name Is A";
yield WaitForSeconds (0.04);
guiText.text = "My Name Is As";
yield WaitForSeconds (0.05);
guiText.text = "My Name Is Ash";
yield WaitForSeconds (2);
guiText.text ="";
}
Can you think about less question marks? It’s needlessly attention-seeking and I don’t think you’re more important than someone who asks politely and clearly.
ps he technique you’re using is stupid. Just add letters to strings. And I don’t think you deserved that answer.
Declare a string variable assigning the complete text.
Declare a float variable that will accumulate the delta time.
Declare a float variable that will store the time each character will wait to appear.
Declare a int variable to store the amount of letters to show.
In the Update method:
Increase the time variable adding the delta time.
If time variable is greater than wait time then
reset to zero the time variable
increment the amount letter variable
split the text by the amount of letters to show and store it into a temp variable
assign to the gui text the parsed text
end if