Hello. How can I make a new line in Unity UI text?
I tried many methods, but every time I have no results.
This is the code:
void Start()
{
StartCoroutine(Check());
TextGameObject.text = "Press The Quotes Button";
}
public void SwitchText(){
QuoteToShow = lineArray [Random.Range (0, lineArray.Length)];
TextGameObject.text = QuoteToShow;
}
private IEnumerator Check()
{
WWW w = new WWW("http://site.com/quotes.txt");
yield return w;
if (w.error != null)
{
Debug.Log("Error .. " +w.error);
textFromServer = textFromLocal;
lineArray = textFromServer.Split("\n"[0]);
}
else
{
Debug.Log("Found ... ==>" +w.text +"<==");
textFromServer = w.text;
lineArray = textFromServer.Split("\n"[0]);
}
}
And this is the text that I want to be on different lines:
“ Start by doing what's necessary, "\n" then do what's possible, \n and suddenly you are doing the impossible. ” \r\n\r\n - Francis of Assisi -
“ The best and most beautiful ; things in the world cannot be ; seen or even touched, they must be felt with the heart. ” \n\r ; - Helen Keller -
This text is located in "quotes.txt"
↧