Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: bobbyk on October 25, 2014, 07:46:24 PM
-
Hello,
I want my labels to have line breaks but when I use \n nothing happens. Same deal both in the main UILabel script and if I feed it using Playmaker.
Am I doing this wrong? I'm simply putting something like "Hello how \n are you?" into the field and the outputs looks exactly the same... is that wrong? also tried \\n
This guy was also getting the same results he has a picture attached http://hutonggames.com/playmakerforum/index.php?topic=4103.msg19243;topicseen#msg19243
-
searched and searched the forums but still confused. here's another thread about this but I still don't understand how to make this work through playmaker's "set property" I still see \n every time. i don't understand how to implement this code Aremook posted. I might just want to use UItextlist but I'm also not sure how that accepts things like line breaks.
http://www.tasharen.com/forum/index.php?topic=5041.msg24130#msg24130
public UILabel myUILabel;
public string myText;
void Start ()
{
myUILabel.text = myText.Replace("\\n", "\n");
}
-
I don't know what playmaker does. From NGUI's point of view, it simply displays what you tell it to. If you type in "hello\nworld" in inspector in Unity, the '\' and 'n' are two characters. They don't get translated to a new line, which is just one character. The code snipplet you pasted (label.text = oldText.Replace("\\n", "\n");) actually replaces the two character sequence with a single new line character.
So instead of setting label's text as "label.text = oldtext;", use the line above.