I’m having tremendous difficulty trying to find the length of a string object that can vary as the host String (Not seen in the example) has different Strings split into an array that can be created/expanded in the hierarchy. Every time I try to find the length, it doesn’t seem to work. The text object I’m making outputs onto a Textmesh. All the examples I saw of how to get a legnth either dealt with GUIText or finding the width of a GUI object as opposed to being based off of text. I don’t want to do either of those. My goal is to print out text in a typewriter fashion, but every time the variable goes to a certain length, the array goes out of range and breaks the script. Is there a way to at least ignore an array once it goes out of range?
Heres what I got down for the typewriter text, at least the best I can interpret from.
var word:String = (“Test.”);
var i:int =0;
var hostWord:String;
function Update()
{
hostWord += word*;*
i++; //Not the best way to add text of course, but this shows how quickly a letter can be added.
Debug.Log(hostWord); //Can also be seen in the hierarchy, but the debug window shows when it’s been updated by every frame according to i++
}