Button bool doesn´t work correctly weird
Opens a Menu if ActiveMenu == true and closes it if it is false. When pressing Escape it opens and closes like it should. But if you press the button it sets ActiveMenu= false, but the menu doesnt close. The Debug.Log gives out 3 x Aus("Off") and 3 x An("On"). The Menu is still there and ActiveMenu is only set true, if Escape is pressed. Also tried it via a switch, but it didn´t work either.
void Update() { if (Input.GetKeyDown(KeyCode.Escape) && !ActiveMenu) { Debug.Log("PressTrue"); ActiveMenu = true; } else if (Input.GetKeyDown(KeyCode.Escape) && ActiveMenu) ActiveMenu = false;
if (ActiveMenu == true)
{
IngameMenu.enabled = true;
EnableIngameMenu();
Debug.Log("An");
}
else if (ActiveMenu == false)
{
IngameMenu.enabled = false;
DisableIngameMenu();
Debug.Log("Aus");
}
}
public void ResumePress() { ActiveMenu = false; }
Answer by Schmollefick · Jun 16, 2016 at 10:24 AM
Seems like it didn´t compile correctly or so... sorry for that.
Your answer
Follow this Question
Related Questions
Joystick buttons don't work 0 Answers
Im trying to make gameObject move only if specific button is pressed 1 Answer
Is it possible to get the screen rect for a button regardless of its parent? 1 Answer
Joystick Input from Switch Pro Controller 0 Answers
How to fix input button is not setup 0 Answers