- Home /
Line Break on text mesh not working?
This is probably going to be a quick one, but I'm a beginner, so I'm kind of confused. On the unity reference for text mesh (http://docs.unity3d.com/Documentation/Components/class-TextMesh.html), it says that when you're typing text into the text property, you can hit alt + return to make a line break. I'm using Windows, so my return button is enter, and when I type and hit alt + enter, nothing happens. I want to have "Hello" on one line, then "World" on the second line, but nothing's happening. Is this a mac exclusive feature or something?
Answer by fafase · Oct 03, 2012 at 07:10 PM
Have you tried:
var str ="Hello\nWorld";
?
Thanks for responding. I haven't tried scripting any text in yet, so no. But that shows me how the scripting for it works, so I'm going to try that ins$$anonymous$$d. Is that code for Java or C# (I work with C#)?
Unity doesn't use Java, but that code is both Unityscript and C#.
Awesome! That sounds good. I'll be sure to implement it later on today. Thanks for helping.
I just tried implementing the code, and I don't think I did it right (I'm a beginner at unity coding). Here's what I have:
using UnityEngine; using System.Collections;
public class journalscript : $$anonymous$$onoBehaviour {
// Use this for initialization void Start () { var str ="Hello\nWorld";
} // Update is called once per frame void Update () { } }
I'm positive I'm doing something wrong with this code. Do I need to erase what's in the text property in the inspector as well?