- Home /
Question by
Sciencephile · Aug 20, 2016 at 09:42 AM ·
c#uitext
(Unity) My Text UI not updating
Ok, so, i try to make something like a quizz, where an array of strings has to be shown to the Text UI. Thing is, the question updates in the inspector after i answer it correctly, however it doensn't on the game screen. Prob a noob mistake, sorry i'm newbie.
public string[] quesitons = new string[] { "2+2 = ?", "1+1 = ?", "3+3 = ?" };
public string[] answers = new string[] { "4", "2", "6" };
public int i = 0;
[SerializeField]
private InputField _input;
//Main
public string currentQ;
public string currentA;
public Text questionText;
public void GetInput(string input)
{
if (input == answers[i])
{
Debug.Log("Correct");
i++;
questionText.text = quesitons[i];
currentQ = quesitons[i];
currentA = answers[i];
}
else
{
Debug.Log("Wrong");
}
}
void Start()
{
currentQ = quesitons[i];
questionText.text = quesitons[i];
currentA = answers[i];
}
}
[1]: /storage/temp/76473-fara-titlu.png
fara-titlu.png
(223.3 kB)
Comment