How do I prevent touches in the screen when pause menu overlay is shown in Unity?

Hi devs,
I am developing a basic game where the character moves to the coordinates where the user have touched.

It works fine. Now that I have added a pause button, which on clicking makes an image and a play button visible (the user will get an understanding that it is an overlay, but which isn’t).

The problem is, when the paise screen is active, on touching anywhere, the character moves to that point, which is not a desired behaviour.

How will I prevent moving the characted when the pause screen is active?

You can just set a simple Boolean in the script that you pause in. Call it “isPaused” for example and when normal gameplay is underway, it will be set to false and when it is paused, it will be set to true. Whatever script you have that deals with the touch movement that controls the player, put a reference to the pause script and if isPaused is true, don’t listen to touches.