I wan’t to be able to toggle on/off a option menu in my game And i’m confused on how to do that, I figured out how to open it but I don’t know how to close it with the same key.
public Canvas IngameOption;
// Use this for initialization
void Start () {
IngameOption = IngameOption.GetComponent<Canvas>();
IngameOption.enabled = false;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown("escape"))
{
IngameOption.enabled = true;
}
}
}