I want this code to run only once every time I press a button, but when I have the code inside Update it gets called several times, which makes sense. I can think of several ugly ways around this, but is there some intended way to deal with this scenario?
private void Update()
{
if (Input.GetAxisRaw("Pause") == 1)
{
if (GameManager.instance.mainState == GameManager.MainState.PLAY)
ShowPauseMenu(true);
else if (GameManager.instance.mainState == GameManager.MainState.PAUSE)
HidePauseMenu();
}
}