- Home /
Respawn Script
I am trying to make a simple game, when my player die or fall from something the player will respawn at his last position. right now i am using this script but my player respawn at from the start
using UnityEngine; using System.Collections;
public class Cave_reset : MonoBehaviour {
void OnTriggerEnter(Collider other)
{
Application.LoadLevel("Cave");
}
}
Comment
Answer by tomsk · Sep 03, 2014 at 11:25 AM
Try to remember players position before he die. And then you can call:
transform.position = Vector3(0, 0, 0);
where Vector3 is your last remembered position :)
Docs: http://docs.unity3d.com/ScriptReference/Transform-position.html
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Could you help me with my respawn script c# 2d engine 0 Answers
Respawn Problem 2 Answers
respawn at current position 0 Answers
Unity Quits Because Of Script!!! 1 Answer