Add to your player script like this one for example:
using UnityEngine;
using System.Collections;
public class RespawnMe : MonoBehaviour {
private static Vector3 respawnPosition = Vector3.zero;
private string levelWeAreIn = "";
void Start () {
if (levelWeAreIn!=Application.loadedLevelName) {
levelWeAreIn = Application.loadedLevelName;
respawnPosition = Vector3.zero;
}
if (respawnPosition==Vector3.zero) respawnPosition = transform.position;
else transform.position = respawnPosition;
}
void OnDestroy () {
respawnPosition = transform.position;
}
}
↧