Ask coding questions

← Back to all posts
Unity Reset Point
darkdarcool (132)


I was working on a unity game a bit, and got the main part of it down. And was planning to make a game! So I made a basic AI and player controller. But, I am struggling with something.

It's going to be roguelike(meaning there is no checkpoints). So I wanted something so that when you fall off(by your own mistake or being hit off), that you go back to the start. But I can't figure out how out make the code for that. Can someone give me a step by step walkthrough how to do it?

Please no videos, I have tried a lot of them and they don't work for me. And don't recommend links, I have tried tons.


Answered by Coder100 (18207) [earned 5 cycles]
View Answer
Coder100 (18207)


you check the player position, like this:

public Transform pos;
public float minimumY;

void Update()
  if (pos.position.y < minimumY)
    // add respawn code

I can't believe you won't watch a tutorial, it would solve things like this for you

like maybe the classic brackeys tutorial:

you see, you literally learn unity through videos not code

darkdarcool (132)

@Coder100 ah, i didn't watch that video, will do! thx! I'll watch the video later and make the spawn point and then you get marked as correct :)

darkdarcool (132)

watched a different video to reset the spawnpoint! but since you were the only person to help, you get marked as correct :)