Main Menu in different scene - pause game

hello

i m new in uniy3d development and i have created a prototype game but i m currently facing with the problem on my main menu

i have been searching scripts or methods to pause my game but all i found is scripted for the game menus created in GUI and my menu is not on gui it s designed on scene as game object

Basically i have 3 scenes

Level 0: Main Menu

Level 1: Game

Level 2: Ingame Menu

and i have gamestate script attached to my player which contains


                void Update () 
                  {

        if(Input.GetKeyDown("escape"))
            {
        Time.timeScale = 0;
        Application.LoadLevel(2);

            }
                  }

when i hit escape button during game , it goes to ingame menu... fine

but i m not quite sure if it freezes game by setting Time.timeScale to zero
because it loads another scene anyway

my ingame menu scene has resume button which is scripted as


        else if(isResumeButton)
    {
    Time.timeScale = 1;
    Application.LoadLevel(1);

    }

so i couldnt find what i want from PauseGame example on unifycommunity and any other examples

any help or idea is appreciated

thanx in advance

Personally it seems a lot easier to have an in-game menu, but okay. What you want is to put in the Start () function of your level 0 the code to pause the game, so it happens as soon as the level is loaded. So in the function where you also have your resumebutton put the script:

function Start () {

Time.timeScale = 0;

}

thanx for reply

my first level is main menu which contains "play game" button so when i hit that button it loads level 1 which is game itself

my question is when i m on level 1 "game" i hit escape button which goes to ingame menu as i add my script in my question sets the time to zero

ingame menu is level 2 and my "resume game" button is scripted as Time.timeScale = 1 and load level 1 "game" it is supposed to continue the game where i left but it starts the level all over from beginning

you suggest me to add Time.timeScale = 0; function on my main menu script which freezes the level 1 at all and even though i set the value 1 and same function to my resume button it still does not work.

any other suggestion?

Hey @seyyid , I see this a very old query and you must have pitched an idea by now. I am having the same trouble but could’nt find a solution yet. I know, one approach is similar to saving a game. You save the states of all the important objects on your hard drive and then enter the another scene and when you come back you load the saved states from the point you left.But how to do this is my question. If you have a solution to or anybody can point in right direction , please respond…