timer help

I need help making my game, at the beginning of each of my levels I want to have a GUI displaying “Play”.

After clicking the “Play” button, a GUI timer will appear, counting down from 10 because my game has a lot of movement in the beginning, so I want the player to ready himself/herself before those 10 seconds are up.

After that I want the game to un-pause letting the player finish the level.

I know I’m asking a lot but could you also teach me how to insert a pause button which is activated by pressing “p” on the keyboard.

Thanks

You need to do this in sections:

First look up for How to create a button

// Make the Play button. If it is pressed, we start a timer
if (GUI.Button (Rect (20,40,80,20), "Play")) {

}

Then google how to do a timer in unity 3d

And for the pause button look up for

timeScale

or

Timer Smple here

The best way to learn is to check for info,samples and try to figure out the solution yourself. ;)

Some script like what i found :

var s = 0;

var m = 0;

var h = 0;

function stopwatch() {

s++;

if (s == 60) {

s = 0;

m += 1;

}

if (m == 60) {

s = 0;

m = 0;

h += 1;

}

Thank you so much but could you tell me how to pause the whole level when i click a button.

Thanks

you can try this:

var paused ; boolean = false;

function Update () {

if(Input.GetButtonUp("Jump")){

      if(!paused){
          Time.timeScale = 0;
          paused = true;
      }else{
          paused = false;
          Time.timeScale = 1;
      }
 }

}

so when u press space bar,it will paused and press again will play again