Show.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        //  check if the GUI is actived
        showing = Object.activeInHierarchy;
        //if the key is pressed and the GUI is showing, hide it
        // else show the GUI
        if (Input.GetButtonDown (InputKey)) {
            //set showing to true if false, if false turn it to true
            showing = !showing;

            Object.SetActive(showing);

            //if other GUI actived turn it off
            if(Other1.activeInHierarchy)
            {
                Other1.SetActive(false);

            }

            if(Other2.activeInHierarchy)
            {
                Other2.SetActive(false);
            }

        }
    }