- Home /
Respawn Button
I am making a running game but I want to make a button so if you fall from the platform, you could simply press something like r to respawn.
How can i make this.
greetings jelle
Answer by MP2fps · Jan 31, 2012 at 07:01 AM
Trust me, i,ve tried this several times on my own game because i also wanted a restart button
function OnGUI () {
if (Event.current.Equals (Event.KeyboardEvent ("r"))) Application.LoadLevel(Application.loadedLevel);
}
Hope this helps
@$$anonymous$$P2fps What your using is for either an older version of Unity or a different language. Because Unity recommends to use 'Scene$$anonymous$$anger.LoadScene' and then there endless errors. Is there another way? If not then let me know.
Your answer
Follow this Question
Related Questions
When my Player respawns, it does not stop moving (it's a ball). 1 Answer
How to have GUI Elements formatted by matrix display correctly in Unity Game View? 2 Answers
Dynamic created button at Mouse Location Moving 0 Answers
Temporarily disable gamepad button 1 Answer
Toggle material color and shader 1 Answer