So I am creating a 2d platformer, and currently I am attempting to get a script to respawn the character when he falls of a platform. I have a box collider below and when the character passes through he is supposed to respawn at (0,0,0), but nothing is happening.
using UnityEngine;
using System.Collections;
public class DeathDetection : MonoBehaviour {
public GameObject player;
private void OnTriggerEnter(Collider collider){
if (collider.tag == "Player") {
player.transform.position = Vector3.zero;
}
else {
Destroy(collider.gameObject);
}
}
}