I am trying to develop a basic car game as a iPhone app, I would like to know how can I have an option to restart the game. Please help me out.
Have another question regarding the JavaScript, how can I roundoff double number to two decimal places.
I am trying to develop a basic car game as a iPhone app, I would like to know how can I have an option to restart the game. Please help me out.
Have another question regarding the JavaScript, how can I roundoff double number to two decimal places.
You could try something like this… use Application.LoadLevel to load the first level again… everything will be destroyed and “Scene1” (or whatever you name it) will load from the beginning… use a GUI Button or something to execute it…
function OnGUI() {
if (GUI.Button(Rect(10,70,50,30),"New Game"))
Application.LoadLevel ("YourSceneNameHere");
}
read more about it here…
http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevel.html
Thanks guys, I have tried Application.LoadLevel(0); last time but it dint work may be because I did not try to Add Levels in Build Settings. I will try adding levels first and then LoadLevel();,
it worked!! thanks guys!!