- Home /
Why won't my scene load?
Hey everyone, I'm very new to Unity and programming. I followed a tutorial online and I'm recreating a pong style game. I created a "game over" scene, and I set up a triggerable box collider that for text that says "Play Again". When the user clicks "play again" (the box collider) I am using this JavaScript:
private var ray : Ray; private var rayCastHit : RaycastHit;
function Update () {
if(Input.GetMouseButtonDown(0)) { ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if(Physics.Raycast (ray, rayCastHit))
{
if(rayCastHit.transform.name == "Play_Again_Button")
{
Application.LoadLevel("Main_Pong_Game");
}
}
}
}
Does anyone know why this wouldn't work? The scene(s) have been added to the build in build settings. Thanks, Adam
Did you try putting a debug message before your LoadLevel call to make sure it actually gets that far?
Answer by eeveelution8 · Jun 11, 2014 at 11:43 PM
might be easier to just do this,
function OnMouseDown(){
Application.LoadLevel("Main_Pong_Game");
}
Your answer
Follow this Question
Related Questions
Parenting Objects 1 Answer
Why isn't my word generator working? 1 Answer
EMERGENCY!!! PLEASE HELP!!!!! 3 Answers