UI problems
Hello coders,
i have two scripts for my ingame menu, the first here call the menu with esc and when i press esc again i can close the ingame menu
public GameObject InGameMenu;
private bool showMenu = false;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape) && !showMenu)
{
InGameMenu.SetActive(true);
showMenu = true;
}
else if (Input.GetKeyDown(KeyCode.Escape) && showMenu)
{
InGameMenu.SetActive(false);
showMenu = false;
}
}
}
My second code is here, to swich the panels on and off
using UnityEngine;
using System.Collections;
public class panelSwitch : MonoBehaviour
{
public GameObject panel;
public void panelOn()
{
panel.SetActive(true);
}
public void panelOff()
{
panel.SetActive(false);
}
}
My problem ist when i call my menu with esc, the ingame menu is open i call a panel as an an example graphics or setting joins the ingame menu and the corresponding panel is called. But now when I again press the ESC key in a submenu opens in the background , the ingame menu again and that should just not be .
I have quite a bit before I attempts now in the forum , write here , I hope someone can give a tip
Comment