A few questions about some GUI text stuff.

Hi,

I have to questions/problems about GUI text so if anyone knows the answers i would greatly appreciate if you could tell me how :stuck_out_tongue:

My first problem is that i was under the impression that by writing “\n” it would split a text line into multiple lines so after that it would be underneath the text that came before the “\n” but it doesn’t work?
This is my script:

var Text : TextAsset;
var arr = new Array();
var NPCnumb = 0;  
var delimiters = new String[1];

delimiters[0] = "...";
arr = Text.text.Split(delimiters, System.StringSplitOptions.None);
guiText.text = arr[NPCnumb];

And this is my text file:

So can you see any problems with that?

My second question is that if anyone knows the best way to do “scrolling” text? like text that slowly writes its self along on the screen(like in Pokemon) like someone was talking and the text comes up as they speak?
The way i could think of is to split the string at every character then have them all in a array then just slowly keep changing what the GUI text to have part of the array until the full array if displayed? but i would think this would be to slow to be really usable.

Thanks to anyone who reply’s :smile: I’m rely tired but i hope that made sense :stuck_out_tongue:

BUMP

If you directly write \n in your text file then the string value will be \n.

Also, why the string.Split call?

To get line breaks in your text from your text file, replace the \n’s with regular line breaks.

Thanks :slight_smile:

The sting.Split is used because i have all the text in my game in the one file, after one finishes it has “…” then the next one starts.

Thanks loads :smile: