I can buy the first two upgrades in a "pause menu". (Which this script is a part of).
However, once I reduce the rate of fire (Rclick.reloadTime) to .8 seconds it simply wont do anything passed that.
if (GUI.Button (Rect(0 + Screen.width * .4, 0 + Screen.height * .4, Screen.width * .05, Screen.height *.05),buttonPlus))
{
if (RClick.reloadTime == 1.0 && NPCSpawning.playerScore >= 5)
{
RClick.reloadTime-=0.10;
NPCSpawning.playerScore -=5;
print ("upgrading to .9");
return;
}
if (RClick.reloadTime == 0.9 && NPCSpawning.playerScore >= 10)
{
RClick.reloadTime -=0.10;
NPCSpawning.playerScore -=10;
print ("Upgrading to .8");
return;
}
if (RClick.reloadTime == 0.8 && NPCSpawning.playerScore >= 15)
{
RClick.reloadTime -=0.10;
NPCSpawning.playerScore -=15;
print ("Upgrading to .7");
return;
}
if (RClick.reloadTime == 0.7 && NPCSpawning.playerScore >= 20)
{
RClick.reloadTime-=0.10;
NPCSpawning.playerScore -=20;
return;
}
if (RClick.reloadTime == 0.6 && NPCSpawning.playerScore >= 25)
{
RClick.reloadTime-=0.10;
NPCSpawning.playerScore -=25;
return;
}
if(RClick.reloadTime == 0.5)
{
print ("Already maxed");
return;
}
}
I have a similar button to "sell back" upgrades and it too won't work at .8 seconds.
I'm at a loss. I don't receive any errors and to me the script portion at .8 seconds looks the same as the rest. I tested it so that upgrading from .9 to lower seconds reduced it by .20 (skipping .8) and it worked just fine.
Maybe it's a syntax problem I'm not aware of?