This is the code I’m using to reload the scene
function Update ()
{
if(Input.GetButtonUp("F"))
{
Application.LoadLevel("Disco strobe physics");
}
When I hit “f” the scene loads with out trouble, but my GUI Timer doesn’t restart. If someone could tell me why/how to fix this that would be cool (I’m a novice as a side note, so take that into consideration).
I should probably include the timer script…
var isPaused : boolean = false;
var startTime : float; //(in seconds)
var timeRemaining : float; //(in seconds)
function Start()
{
startTime = 60.0;
Debug.Log("STARTED");
}
function Update()
{
if (!isPaused)
{
DoCountdown();
}
}
function DoCountdown()
{
timeRemaining = startTime - Time.time;
ShowTime () ;
if (timeRemaining < 0)
{
timeRemaining = 0;
isPaused = true;
TimeIsUp() ;
}
}
function PauseClock()
{
isPaused = true;
}
function UnpauseClock()
{
isPaused = false;
}
function ShowTime()
{
var minutes : int;
var seconds : int;
var timeStr : String;
minutes = timeRemaining/60;
seconds = timeRemaining % 60;
timeStr = minutes.ToString() + ":";
timeStr += seconds.ToString("D2");
guiText.text = timeStr; //display the time to the GUI
}
function TimeIsUp()
{
guiText.text = ("Time is up!");
}
Thanks in advance