UI won't activate

I’m trying to get my console UI to open when you press enter or return. But it just wont work. I think my code is correct but I’m not sure.

My code:

public static bool Console = false;

public GameObject consoleUI;

void Update()
{
    if (Input.GetKeyDown(KeyCode.Return))
    {
        if (Console)
        {
            Open();
        }
        else
        {
            Close();
        }
    }
}

public void Open()
{
    consoleUI.SetActive(true);
}

public void Close()
{
    consoleUI.SetActive(false);
}

Is the Console value, changed in any other script ?

If that’s not the case, it is set to false at it’s declaration and never changed, so in every Update in which the Return key is pressed it will just call the Close method.

If you prettend to make it toogle on and off by pressing Return, you’d have to change the Console value, and the conditional should go the other way around:

 if (Input.GetKeyDown(KeyCode.Return))
     {
         if (!Console)
         {
             Open();
         }
         else
         {
             Close();
         }
     }
 }
 public void Open()
 {
     consoleUI.SetActive(true);
    Console = true;

 }
 public void Close()
 {
     consoleUI.SetActive(false);
    Console = false;
 }