press esc to show a GUI menu

Hello

I wrote currently a game code, but im stuck with a big problem. I want that, when the esc key is pressed, the menu is showed.

That is my hierarchy:

Canvas

Panel

TextScore // to show the score on the screen

FinishMenu // when the level is complete

QuitButton

MenuButton

NextButton
EscapeMenu // whenn you press esc key, menu is showed
QuitButton

MenuButton

ReplayButton

ContinueButton
FallDownMenu // when the player die, the menu is showed
QuitButton

MenuButton

ReplayButton
PauseButtonImage // Image ( || ) for pause on the screen

a) when the level is complete, a menu is showed with differents buttons like in the hierarchy. it works

b) when the player (gameObject) dies, a menu is showed. It works like a)

c) But while you play and try the esc key, the game is paused but the menu is not showed
that is the code

public GameObject escapeMenues;
    public bool isPaus;
    private int escCount = 0;

    public Text textScoreText;
    public Text topScoreTop;

    void Start()
    {
        isPaus = false;
        escapeMenues.SetActive(false);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && escCount == 0)
        {        
            setPause();
           
            SetCountText();
            escapeMenues.SetActive(true);           
            escCount = 1;
        }
        if (Input.GetKeyDown(KeyCode.Escape) && escCount == 1)
        {          
            setPause();          
            escapeMenues.SetActive(false);           
            escCount = 0;
        }
    }

    public void loadNaechsteLevel()
    {
        //Application.LoadLevel(_levelName);
        Application.LoadLevel(Application.loadedLevel + 1);
    }

    public void loadSelbeLevel()
    {
        Application.LoadLevel(Application.loadedLevel);
    }
    public void loadMenu()
    {
        Application.LoadLevel("Menus");
    }
    public void VerlasseDasSpiel()
    {
        Application.Quit();
    }

    public void setPause()
    {
        if (!isPaus)
        {
            Time.timeScale = 0;
        }
        else
        {
            Time.timeScale = 1;
        }
        isPaus = !isPaus;
    }

    void SetCountText()
    {
        textScoreText.text = RotateSphere.countPickUp.ToString();
        topScoreTop.text = RotateSphere.topScore.ToString();
    }

I assigned public GameObject escapeMenues with EscapeMenu in my hierarchy

I also tried to debug it. I wrote some Debug.Log(); in to if (Input.GetKeyDown(KeyCode.Escape) && escCount == 0). It works of cause, then the game is paused but the menu is not showed.

The plattform is android

Please i need you help, thank you !!

You could try this instead:

void Update()
     {
         if (Input.GetKeyDown(KeyCode.Escape))
         {        
             setPause();
            
             SetCountText();
         }
     }

public void setPause()
     {
         if (!isPaus)
         {
             Time.timeScale = 0;
         }
         else
         {
             Time.timeScale = 1;
         }
         isPaus = !isPaus;
         escapeMenus.SetActive(isPause);
     }

This is how the scene window look

![t][1]

and the game window

!

and the code that work with the other menu

    public Text winText;
    public Text textScoreText;
    public Text topScoreTop;

    public GameObject imageScore;

    public bool isPaus;

	// Use this for initialization
	void Start () {
        winText.text = "";
        isPaus = false;
        imageScore.SetActive(false);      
	}
	
	// Update is called once per frame
	void Update () {
        
	}

    IEnumerator OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            winText.text = "Level Complete!";
            Destroy(other.gameObject);
            yield return new WaitForSeconds(2);
            Destroy(winText);
            SetCountText();
            imageScore.SetActive(true);          
        }
    }

    void SetCountText()
    {
        textScoreText.text = RotateSphere.countPickUp.ToString();
        topScoreTop.text = RotateSphere.topScore.ToString();
    }

    public void VerlasseDasSpiel()
    {
        Application.Quit();
    }

    public void setPause()
    {
        if (!isPaus)
        {
            Time.timeScale = 0;
        }
        else
        {
            Time.timeScale = 1;
        }
        isPaus = !isPaus;
    }

    public void loadNaechsteLevel()
    {
        Application.LoadLevel(Application.loadedLevel + 1);
    }

    public void loadSelbeLevel()
    {
        Application.LoadLevel(Application.loadedLevel);
    }
    public void loadMenu()
    {
        Application.LoadLevel("Menus");
    }

On the smartphone the pause and esc button doesnt work and when i touch on the screen, it seems to pause the game rather than jump. Maybe it is the gui. But i think what ive done with the gui is correct. I already spent a lot of time with it. Pls i need u help !

http://answers.unity3d.com/answers/1063762/view.html