Help with button events not working as planned
Hiya all, cant seem to find a relevant post so here goes. i have an upgrades menu that enables another upgrades menu, that works. In that menu, there is 3 buttons for upgrading the base upgrades, essentially. i can get the first button to pop up for me, when using [code = C#]
//Upgrade1 if (CashCount >= MinerUpgrade1Cost) { FakeButton6.SetActive(false); RealButton6.SetActive(true); } else { FakeButton6.SetActive(true); RealButton6.SetActive(false); } if (TurnOffButton6 == true) { RealButton6.SetActive(true); FakeButton6.SetActive(false); TurnOffButton6 = false; }
[/code] this basically says if your money is higher than the cost of the upgrade turn off the fake button (which is the sprite but black, without any OnClick events) and turn on the real button (color sprite with all OnClick events) but when it comes to making my second button /3rd button become active (if value for button one is true) I cant get it to work at all.
[code =C#] //Upgrade2
if (CashCount >= MinerUpgrade2Cost)
{
if (MinerUpgrade1Value == true)
FakeButton7.SetActive(false);
RealButton7.SetActive(true);
}
else
{
FakeButton7.SetActive(true);
RealButton7.SetActive(false);
}
if (TurnOffButton7 == true)
{
RealButton7.SetActive(true);
FakeButton7.SetActive(false);
TurnOffButton7 = false;
}
[/code]
button three script is the same but with 2s changed to 3s.
ive even tried disabling the buttons via [code] "RealButton7.GetComponent().interactable [/code] with no avail either, but I dont really even wanna disable it just make it unclickable unless the first upgrade is unlocked. . this is starting to drive me nuts!!! is this something to do with the MinerUpgrade1Value bool, as it works fine when Cash >= Cost if I remove the second "if" statement? am I doing something wrong here? Any help would be great, thanks guys!!!!