So basically in my game to drop armor that’s on you press Q and Shift and when you press it my dropping bool turns true so my armor drop method will only be called once but its not working it still gets called 2 or more times heres the code.
public Helmet HeadGear;
public Leggings PantsGear;
public ChestPlate ChestGear;
public Boots ShoeGear;
public bool ArmorDropping;
if (Input.GetKey(KeyCode.Q)&& Input.GetKey(KeyCode.LeftShift))
{
ArmorDrop();
ArmorDropping = true;
}
void ArmorDrop()
{
if (ArmorDropping == true)
{
if (HeadGear != null)
{
HeadGear = null;
ArmorDropping = false;
}
else
{
if (ChestGear != null)
{
ChestGear = null;
ArmorDropping = false;
}
else
{
if (PantsGear != null)
{
PantsGear = null;
ArmorDropping = false;
}
else
{
Debug.Log("No Armor on");
ArmorDropping = false;
}
}
}
}
}