I wanted a simple system to display two lines of text,and every time i press the space bar,change the two lines to the next ones in a array,i assigned 6 lines in the inpector,but after i press the key for the second time,it load the next scene,without all the lines showing.
using UnityEngine; using System.Collections; public class sistemaconversa : MonoBehaviour { public string [] texto1; public string [] texto2; public GUIText tex1; public GUIText tex2; int i = 0; int o = 0; void Start () { i = texto1.Length; tex1.text = texto1 [0]; tex2.text = texto2 [0]; } // Update is called once per frame void Update () { if(Input.GetKeyUp("space")) { o +=1; tex1.text = texto1 [+1]; tex2.text = texto2 [+1]; } if(o > i ) { Application.LoadLevel(Application.loadedLevel+1); } } }