Basically here is my problem. I want to have a certain GUI element to be added if a certain condition is met but it does not seem to be working.
Here is my code:
function OnGUI()
{
GUI.Label(Rect(80, 10, 50, 20), "Gold:");
GUI.Label(Rect(130, 10, 50, 20), gold.ToString());
if (gold >= 10 && numOfObjects < 6)
{
gold -= 10;
if(slot1 == false)
{
GUI.Box(Rect(200, 10, 50, 20), "TEST");
slot1 = true;
numOfObjects++;
}
First two GUI elements work but not the one that is dependant on the condition. If I move the GUI.Box code up, below the other GUI elements it works. Any ideas ? And by work btw I mean that the Box is not showing up on the screen.