Question by
Suzzzze · Oct 08, 2015 at 11:27 AM ·
javascriptscene-loading
Application.LoadLevel(""); - doesn't load my Scene
Hi, I want back to my menue when I lost my game, so when the time up. But timer disappears when the time is zero, so that works but it doesn't load my menue/scene.
Can anyone help me please :)
timer.js
#pragma strict
import UnityEngine.UI;
var countdown : float;
var timer : UI.Text;
function Start () {
}
function Update()
{
timer = GetComponent(UI.Text);
countdown -= Time.deltaTime;
var minutes = Mathf.Floor(countdown/60).ToString("00");
var seconds = (countdown % 60).ToString("00");
timer.text = minutes +":" + seconds;
if(countdown <= 0.00)
{ timer.active=false;
Application.LoadLevel("Lostgame");
}
}
Comment
Best Answer
Answer by Gilles_aerts · Oct 08, 2015 at 11:42 AM
Hi, if you want to load a scene you have to add the scene to you build settings first. You can do this by opening the screne you want, then do file(i'm not sure if its under file) > open built settings en then press add this scene. then the application.loadlevel will work. a shortcut to open your build setting is shift+ctrl+b i believe