Pause menu

Hi, i am trying to develop a game in unity. For that game i designed a pause menu, even pause menu appearing on touch fire is running in background how can i solve this problem.

Usually, the easiest way to make most stuff in the scene pause is by setting the time scale to zero:

Time.timeScale = 0;

(and to turn back normal):

Time.timeScale = 1;

anything that still moves after that, you would need to create additional code for:

var paused : boolean;

function Update(){
    if(paused == false){
    //any code goes in here
    }    
}

this way when you pause, you just set the var “paused” to true, that way nothing happens