How to call a new scene in unity

Hi All,

Currently i am doing one game application.Here i need to show the level with some fixed time.
After starting the application i need to show my first seen with Start button.After click Start button it will play my game up to 1 min.Then again it should show the scene Level1 and continue my game.
1)Here already i done my first scene with start button.After click Start button its playing my game.

2)Here after one minute i want to call my second scene with Level1 Button.

Here i don’t know how to call my second scene with time.If anybody know about this,Please share your knowledge.

Thanks in Advance,

Attach a script to your camera or another game object in the scene.

private var myTimeout:float;
function Start()
{
myTimeout = Time.time+60; // 60 second delay
}

function Update()
{
if( Time.time > myTimeout )
{
Application.LoadLevel("TheSceneToLoad");
}
}

Thanks for your quick reply.

My requirement is i want to show the levels while running the application with fixed time.
After starting my application i need to show my first seen with Start button.After click Start button it will play my game up to 1 min.After that it should show my second scene with Level1 button.If i click Level1 button it again play my game up to 2 min.Then again it should show the scene with Level2 button.If i click Level2 button it will continue to play my game.
1)Here already i done my first scene with start button.After click Start button its playing my game.

Below i am using the following code to call my scenes with timing.But its not working.

var icon : Texture2D;
var customSkin : GUISkin;
function OnGUI () {

//print(“GUI----->”);
GUI.skin = customSkin;

if (GUI.Button (Rect (250,150, 70,50), “Start”))
{
//GameController.levelselected=0;
print(“Level0”);
Application.LoadLevel(“Second1”);
Invoke(“Level1”,60);

}
GUI.skin = null;
}

function level1()
{
print(“level1 ----------------------------------->”);
if (GUI.Button (Rect (250,230, 70,50), “Level1”))
{
//GameController.levelselected=1;
print(“Level11”);
Invoke(“Level2”,120);
Application.LoadLevel(“Second1”);

}

}

function Level2()
{
print(“Level2”);
if (GUI.Button (Rect (250,310, 70,50), “Level2”))
{
//GameController.levelselected=2;
print(“Level22”);
Application.LoadLevel(“Second1”);
}
}
May i know what is the problem for above code.
Here my problem is even it was not calling my second function[Level1].I don’t know what is the problem.Please help me to sort out this problem.

Firstly, you are calling Invoke after Application.LoadLevel (this function immediately loads the new level and throws out the current one, so Invoke will not be called). Secondly, assuming this is all one script, it will be unloaded when the new level starts. You need to call the code to load the new level and then in that level, have a script that goes back to the menu after the time is up.

Hi,

Thank you so much your reply.Now its working great.What you mentioning that exactly corrects.

Thanks,