Thursday, August 30, 2012

Unity: Getting new line in inspector entered strings to work

It's weird - in a script I had some text defined with \n to create a new line and that worked out.

But when I defined an array of strings and filled them in in the inspector, it'd just show the \n instead of creating a new line!

So here's a solution:
guimessage = guimessage.Replace("/n", "\n");
 In your strings, have /n instead of \n. It'll replace them and for some reason, they then start working! It puts the special magic back in!

No comments:

Post a Comment