- Home /
Trouble with restarting 2D tutorial
Hey there, I've just been starting with Unity and actually got through all tutorials (except for the stealth one, because my Netbook cant handle it). I aquired some knowledge of Java in college and I was able to alter the tutorials to make them more fun for me personally.
In the 2D tutorial are mobile controls introduced and I actually wanted to try them on my phone. But I cannot restart the game. So whenever it gets to gameover() it wont restart. I tried
if (Input.GetMouseButtonDown(0)||Input.GetKeyDown(KeyCode.Return) {
Awake ();
}
inside the gameover function, but it did nothing. As did the same code with calling the InitGame function and with Application.Loadlevel(0); as this game only has one Scene.
When I browsed through the Internet to find answers it seems Application.LoadLevel(0); would be the right one but it said it has to be in the Update function. So I put it there and then nothing worked anymore.
It says error Unexpected Symbol { (i checked every { has a } and there arent more than there have to be) error A Namespace can only contain types and Namespace declarations (twice) Parsing error.
When I delete the if declaration or just put it outside of the update function everything works fine.
Thanks for any help, hopefully there is just something I couldnt know and thats why it wont work.
Answer by Paul-Sinnett · May 13, 2015 at 09:01 AM
You are missing a normal bracket:
if (Input.GetMouseButtonDown(0)||Input.GetKeyDown(KeyCode.Return) {
^
|
missing normal close bracket here
Your answer
