Hello!
I am making a game with animated dialogue and I run into a problem when one word is being written in one line and then when it takes too much space it jumps down to the next line. I demonstrated that in this video (I slowed down text writing so it’s obvious what is happening). You can see the word “possible” being written in one line, and then finished down on next line.
Does anyone have any idea how we could predict that word is going to be too long for that line, and then start writing it in next line right away? I had idea of testing how long the next word is going to be, by checking how many characters there are until the next Space in string. But even if I do this, I don’t know how to test if that word is going to be too long to fit in current line or will it be pushed into the next line.
Here is simplified version of function that I run in Update() to animate text:
if (currentlyAnimatedText.Length > 0)
{
char letter = char.Parse(currentlyAnimatedText.Substring(0, 1));
currentlyUsedDialogueBox.text += letter;
currentlyAnimatedText = currentlyAnimatedText.Remove(0, 1);
}
Any ideas?
Thanks!