Relative Content

Tag Archive for c#stringunity-game-engineuser-interfacetext

Unity C# – Check for overflow text in a text box. If so remove it and move it into the beginning of a string list

I’m making a typing game that pulls lines from a text file, adds them to a string array and displays as many as it can fit in a text box. When all lines that currently fit are typed, they are removed from the list and the text box and replaced with the next set of lines that can fit. The text box right now will add lines to the text box until a line would be added that would make the text overflow. Since some lines are longer than the entire length of the text box I want the system to remove only the text that would overflow, not the entire line.