I have a pause button in my mobile game, but I have touch input = 1 to jump. So everytime I touch the screen, whether it’s on the pause buton or not, the player will still jump. if I touch the pause button, the play er jumps, but it also pauses the game. How can I make it to where if I tap the button, it will only pause the game, touching anywhere else acts as the jump. Here is the code I am using.
foreach (Touch touch in Input.touches) {
if (touch.tapCount == 1) {
if(touchingPlatform) {
JumpSound();
//rigidbody.velocity = new Vector3(velocity1, 7,0);
rigidbody.AddForce(jumpVelocity, ForceMode.VelocityChange);
touchingPlatform = false;
}
}
else if(boosts > 0 && touch.tapCount == 2) {
rigidbody.AddForce(boostVelocity, ForceMode.VelocityChange);
boosts -= 1;
GUIManager.SetBoosts(boosts);
}
}