Hi, the problem is that if have a script to buy items in the game, but when I try to make a GUI Box or label, it doesn’t appear, why does this happens? It only happens with one GUI the rest is working fine, it is marked in the script with the commented line.
OnGUI Buy Script:
void OnGUI()
{
if(buyClicked == true)
{
GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "");
GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "");
GUI.Label(new Rect(Screen.width/2 - 115, Screen.height/2 - 45, 250, 125), "Do You Want To Buy It?", runnerText);
if (GUI.Button (new Rect (Screen.width/2 - 100,Screen.height/2,100,60), "Yes", runnerButton))
{
coins = PlayerPrefs.GetInt("Total_Coins");
//This if statement is the GUI that doesn't works.
if(coins < helmValue)
{
GUI.Label(new Rect(Screen.width/2 - 115, Screen.height/2 - 45, 375, 187), "You Don't Have Enough Money", runnerText);
}
else if(coins >= helmValue)
{
PlayerPrefs.SetInt("Total_Coins", coins - helmValue);
PlayerPrefs.SetInt(helmOK, 1);
renderer.enabled = false;
buyClicked = false;
}
}
if (GUI.Button (new Rect (Screen.width/2 + 20,Screen.height/2,100,60), "No", runnerButton))
{
buyClicked = false;
}
}
}