I have these buttons that when pressed become toggled, and at the same time untoggles the ohter 7 buttons to make only 1 of the toggled at all times. It works to some degree, but only if the old toggled button is lower on the list than the new toggled button.
Example, if AmazonianBtn is toggled, it does not untoggle when any of the below buttons are clicked and they are also not being toggled in this situation. But if toggled button is low on the list and the new toggled button is higher on this list it toggles+untoggles just fine.
What am i missing here? It seems such simple code and im really embarrased to ask as its probably something silly >.<
public void ToggleHandler()
{
if (classAmazonianBtn.thisToggled)
{
classMagusBtn.thisToggled = false;
classShadowspawnBtn.thisToggled = false;
classBlackguardBtn.thisToggled = false;
classSenjuMonkBtn.thisToggled = false;
classDeadeyeBtn.thisToggled = false;
classGladiatorBtn.thisToggled = false;
classTemplarBtn.thisToggled = false;
}
if (classMagusBtn.thisToggled)
{
classAmazonianBtn.thisToggled = false;
classShadowspawnBtn.thisToggled = false;
classBlackguardBtn.thisToggled = false;
classSenjuMonkBtn.thisToggled = false;
classDeadeyeBtn.thisToggled = false;
classGladiatorBtn.thisToggled = false;
classTemplarBtn.thisToggled = false;
}
if (classShadowspawnBtn.thisToggled)
{
classAmazonianBtn.thisToggled = false;
classMagusBtn.thisToggled = false;
classBlackguardBtn.thisToggled = false;
classSenjuMonkBtn.thisToggled = false;
classDeadeyeBtn.thisToggled = false;
classGladiatorBtn.thisToggled = false;
classTemplarBtn.thisToggled = false;
}
if (classBlackguardBtn.thisToggled)
{
classAmazonianBtn.thisToggled = false;
classMagusBtn.thisToggled = false;
classShadowspawnBtn.thisToggled = false;
classSenjuMonkBtn.thisToggled = false;
classDeadeyeBtn.thisToggled = false;
classGladiatorBtn.thisToggled = false;
classTemplarBtn.thisToggled = false;
}
if (classSenjuMonkBtn.thisToggled)
{
classAmazonianBtn.thisToggled = false;
classMagusBtn.thisToggled = false;
classShadowspawnBtn.thisToggled = false;
classBlackguardBtn.thisToggled = false;
classDeadeyeBtn.thisToggled = false;
classGladiatorBtn.thisToggled = false;
classTemplarBtn.thisToggled = false;
}
if (classDeadeyeBtn.thisToggled)
{
classAmazonianBtn.thisToggled = false;
classMagusBtn.thisToggled = false;
classShadowspawnBtn.thisToggled = false;
classBlackguardBtn.thisToggled = false;
classSenjuMonkBtn.thisToggled = false;
classGladiatorBtn.thisToggled = false;
classTemplarBtn.thisToggled = false;
}
if (classGladiatorBtn.thisToggled)
{
classAmazonianBtn.thisToggled = false;
classMagusBtn.thisToggled = false;
classShadowspawnBtn.thisToggled = false;
classBlackguardBtn.thisToggled = false;
classSenjuMonkBtn.thisToggled = false;
classDeadeyeBtn.thisToggled = false;
classTemplarBtn.thisToggled = false;
}
if (classTemplarBtn.thisToggled)
{
classAmazonianBtn.thisToggled = false;
classMagusBtn.thisToggled = false;
classShadowspawnBtn.thisToggled = false;
classBlackguardBtn.thisToggled = false;
classSenjuMonkBtn.thisToggled = false;
classDeadeyeBtn.thisToggled = false;
classGladiatorBtn.thisToggled = false;
}
}