TextMesh RPG text scroll

I wanted to know how it would be possible to make TextMesh mimic oldschool RPG textscrolling that you see in the dialogue boxes(or you can refer to how the ace attorney series handled its text scrolling).

I imagine it’s possible, but I haven’t found a proper way to do it.
Any insight would help!

This will do it:

function TextScroll() {
   var myString:String = "Scrolling text";
   var charIndex:int;

   for (var i:int=0; i<myString.length; i++)
   {
      yield WaitForSeconds(.1);
		
      GameObject.Find("TEXTMESH_OBJECT_NAME").GetComponent(TextMesh).text += myString[charIndex++];		
   }
}

I recently tackled this for my entry to Ludum Dare 28. As it was a compo entry, the source code is posted with the game.

You Only Get One by Broxxar | Ludum Dare 28

You can check out the DialogueController.cs script to see what I did. The part you’ll be interested in is the coroutine. It iterates from 0 up to the dialogue string length and sets the TextMesh.text to a substring of the dialogue, yielding each iteration for 50 ms.

for (int i = 0; i <= dialogue.Length; i ++) {
	textMesh.text = dialogue.Substring(0, i);
	yield return new WaitForSeconds (0.05f);
}

There’s a lot of other garbage in that class (sorry, game jam code can get messy) but hopefully it has what you need, or at least something to get you on the right path!