I have a label that displays the amount of gold the player has in his inventory, but can’t get the label to change the number written in it as the amount of gold the player has changes… What do I do?
public string testText;
void OnGUI()
{
GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height * 0.050f, 200, 200), testText, "MainMenuStyle");
}
Works for me, when changing the text variable in the inspector and the same principle should apply editing the variable from within code.
I think OnGUI() is vaguely similar to Update(), in that it calls every frame (Or something to that effect). Unity - Scripting API: Event