Enabling/Deactivating objects using keys.

Basically I have this script that I have put below, and the issue is that I can not get the boolean to change nor is the item switching working, I’m not sure what I have done wrong I have this attached to a Empty object as shown in the image below, I am not sure if this is due to it being in an empty object(though it is always active) or if it is because I have done the Input code wrong, Hope someone can help, Thanks

public class SelectWeapon : MonoBehaviour
{
    public bool Item1IsOn = true;
    public bool Item2IsOn = false;

    void update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            this.transform.GetChild(InventoryScript.ItemIndex1).gameObject.SetActive(Item1IsOn);
            Item1IsOn = !Item1IsOn;
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            this.transform.GetChild(InventoryScript.ItemIndex2).gameObject.SetActive(Item2IsOn);
            Item2IsOn = !Item2IsOn;
        }
    }
}

143061-emptyobjectscript.png

You need to capitalize the U in Update :slight_smile: