Hello guys.
using UnityEngine;
using System.Collections;
public class LevelManager : MonoBehaviour {
public GameObject currentCheckpoint;
public GameObject deathParticle;
public GameObject respawnParticle;
private PlayerController player;
public float respawnDelay;
void Start ()
{
player = FindObjectOfType<PlayerController> ();
}
void Update ()
{
}
public void RespawnPlayer()
{
StartCoroutine ("RespawnPlayerCo");
}
public IEnumerator RespawnPlayerCo();
{
Instantiate (deathParticle, player.transform.position, player.transform.rotation);
player.enabled = false;
player.GetComponent<Renderer> ().enabled = false;
Debug.Log ("PlayerRespawn");
yield return new WaitForSeconds (respawnDelay);
player.transform.position = currentCheckpoint.transform.position;
player.GetComponent<Renderer> ().enabled = true;
Instantiate (respawnParticle, player.position.transform, player.transform.rotation);
}
}
for some reason it says I have a problem with my script never happened before, it says all the (GameObject) stuff are not exist in the current scene, I’m having headache coz of that and here’s my script, any help would be appreciated.