Pause button triggers a jump.

Hello,

I am making a 2D platformer type of game and I have Spacebar and left-mouse button as my jump keys.
So basically when I click on my pause button, it does the pause the game, however, it also triggers a jump and basically, the players hang around in the middle of the jump.
How can I make a click on the pause button to not register as a jump command?

public class PauseMenu : MonoBehaviour {

public string mainMenuLevel;

public GameObject pauseMenu;

public void ResumeGame() {

	Time.timeScale = 1f;
	pauseMenu.SetActive (false);

}

public void PauseGame() {

	Time.timeScale = 0f;
	pauseMenu.SetActive (true);

}

public void RestartGame () {

	Time.timeScale = 1f;
	pauseMenu.SetActive (false);

	FindObjectOfType<GameManager> ().Reset ();

}

public void QuitToMain(){

	Time.timeScale = 1f;
	SceneManager.LoadScene (mainMenuLevel);

}

}

Inside your script, add a method to activate the leftclick as jump and antother one that does the contrary (or a unique method with a boolean parameter that activate it or not depending the boolean state).

On your button component, add an event trigger component, add two events in that components “PointerEnter” and “PointerExit”, in the “PointerEnter”, in the “PointerEnter” call the desactivation of the left click as jump and vice versa for the “PointerExit”.