When I lose my life, On RespawnPoint, my Prefab player is invisible. I can move him but I cant see him.
using System.Collections;
using UnityEngine;
public class GameManager : MonoBehaviour {
public static GameManager GM;
public GameObject prefab;
private GameObject respawnPoint;
public int lives;
void Awake()
{
if (GM == null)
{
GM = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
respawnPoint = GameObject.FindGameObjectWithTag(“Respawn”);
}
public IEnumerator Respawn()
{
//do something
lives -= 1;
if (lives < 0)
{
Debug.Log(“here use end screen”);
}
yield return new WaitForSeconds(2f);
if(lives>=0)
Instantiate(prefab, respawnPoint.transform.position, respawnPoint.transform.rotation);
//do something
}
}