Hi, I am making a game that realies heavilly on narrative and I believe it to be extremely tedious to have to write many quotaion marks for longer strings. In python, you could use multi-line strings like this: """ Insert multi-line quote here """" Surely, there has to be a way to perform this in javascript. In case you need to know, I use notepad++ as my text editor. All help appreciated.
There isn't a way. Use "\n" for a newline character. Code (javascript): var text = "Insert multi-line quote\nhere"; --Eric
You may want to consider a data-driven approach: put the text you want into a file (or files) on the disk, and then use it as a Unity3d TextAsset object, which you can drag-by-reference into a script in the editor window. Then you can access the text strings in code and display them that way.
That won't actually work; it is a requirement that a string is all on one line. (You can concatenate over multiple lines, but the OP didn't want to do that.) --Eric
EDIT: What I wrote does not work in UnityScript. I'm too used to C# >.> Spoiler Code (csharp): string worksExceptDoubleQuote = @"This is a way you can have strings across multiple lines. Unless it's a "", then you need to escape with another "" in front of it."; // This is // a way you can have strings // across multiple lines. // // Unless it's a ", then you need to escape // with another " in front of it. I like putting text in files so I don't have to worry about escaping anything. (Apparently the forum doesn't know how to properly color that code!)