Hi! i am middle of something… what is happening in my game, i have two scenes, scene1 and scene2 , i have a script of timer which actually is the score which should start when i load the scene2 as in the temple run ,subway surfer etc. when i play my game first it show the menu scene then we hit play and move to scene2, now what is happening when game load scene1 starts, my timer score starts counting time score in the scene1 although my script and score gui is in the scene2. and when my player collide and we go back to scene1 the score is running and after again loading the scene2 the scores are like 1000…1950…what i want to just to start my score in the scene2 and after reloading scene2 start form the zero.
#pragma strict
private var startTime:float;
// var labelPosition : Rect;
var labelText : String;
var labelStyle : GUIStyle;
var score : int;
static var timerstart:boolean = true;
function Update()
{
if (timerstart)
{
startTime= Time.deltaTime;
//startTime=
labelText = startTime.ToString();
}
}
function OnGUI()
{
GUI.Label(Rect (Screen.width-125, 30, 130, 25), labelText, labelStyle);
}