I created a simple “typing” script. It’s working on PC just fine… but it’s not doing the “line break” on Android. Any ideas? Here’s the code:
void Update () {
if ((Time.realtimeSinceStartup - _lastUpdate) > updateSpeed)
{
if (_cnt + 2 <= credits.Length)
{
if (credits.Substring(_cnt, 2) == System.Environment.NewLine)
{
//this isn't running on Android, but works on PC
//add a line break (move position down by lineBreakSize
gameObject.transform.position = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y + lineBreakSize, gameObject.transform.position.z);
}
_lastUpdate = Time.realtimeSinceStartup;
gameObject.GetComponent<UILabel>().text = credits.Substring(0, _cnt);
_cnt++;
}
}
}
I’ve also tried:
if (credits.Substring(_cnt, 2) == System.Environment.NewLine | credits.Substring(_cnt, 2) == "
" | credits.Substring(_cnt, 4) == "
")
Just to add more information credits is just simply defined as a string:
public string credits;
I typed up the text in notepad (just a txt file) and paste the text into the Unity Editor into that string variable.