Pause-Resume one button using switch statements?


at the moment I´m programming a simple “SideScroller”-Game. Collecting Points, Timer and Restarting Level. All these things were done alread.

Now I´m wanted to have a “Levelmenu”, where you can pause the game or go back to the main-menu. Well one button for “Main-Menu”, one button for “Pause” and one button for “resume”, thats easy to done using switch statements.

But in the end, I don´t like these menu. Pausing and Resuming a game with 2 buttons? Thats not good in my opinion.

So in the end in my Level-Meu should have these following buttons:

  • “Main Menu”
    -“Resume” and “Pause” as one button

By clicking e.g. “Resume”, the game resumes and the button “Pause” comes. For clicking “Pause” the other way.
I´m using strings for the names of the buttons

Is it possible to use switch stetements for this? If yes, how can I do it? Has someone a example for that?

private int pauseCount;
// Use this for initialization
void Start () {
pauseCount = PlayerPrefs.GetInt(“Previous game state”); //At The time of loading set pauseCount = 1 as PlayerPrefab

	// Update is called once per frame
	void Update () {
		if (pauseCount % 2 == 1) {
			// Here play the Game
			// Here Pause the Game
//Detecting Mouse click
	void OnMouseUp(){
		pauseCount ++;