How to stop code from triggering when pressing screen

So I have a simple game for phones, where if you press the left side of the screen, a ball will move to the left, and if you press the right side of the screen, the ball will move to the right. I decided to add a small pause button at the bottom left, but when I press it, the ball will move to the left and then the game will pause, are there any simple fixes for this?

We may need to see your code as it could be a simple execution order problem, did you place the pause code/function at the top of the update function? If we could see the actual code though it would make everything clearer.

I agree with @Lethn , we can probably add more if you post some relevant code, but here’s an approach that might work for you:

When paused set a boolean in your ball-moving code that you can check to not do the Update().

Something like:

public bool Paused;

void Update()
{
 if (Paused) return;            // don't do anything while paused

 // ... all the rest of your Update code here that makes it track the ball
}

Alternatively you can use it to lock out the code in the ball-mover that reads the screen input.

Obviously when you unpause, clear that boolean.