Hi guys, I have made a Player Die script for my 2d game so when the player falls of the platform he dies but i am trying to make it so when the player dies he respawns a couple of seconds later in coordinates (0.04833326, 3.980667, 0), here is my script i cant seem to get it to work.
Thank You
using UnityEngine;
using System.Collections;
public class PlayerDie : MonoBehaviour {
void OnCollisionEnter2D(Collision2D collision){
if (collision.gameObject.name == "Respawn") {
StartCoroutine(DieAndRespawn());
}
}
IEnumerator DieAndRespawn() {
renderer.enabled = false;
yield return new WaitForSeconds(2.0f);
transform.position = new Vector3(0.04833326f, 3.980667f, 0.0f);
transform.rotation = Quaternion.identity;
renderer.enabled = true;
}
}