using UnityEngine; using System.Collections; public class Respawn_Point : MonoBehaviour { [Header(">>>>>This element will constantly respawn one sample of a specifyed game object, if that game object is destroyed, it will be respawned after a delay")] public GameObject GO_Spawn; private GameObject Instantiated_GO; public GameObject Respawn_position; [Header("How long it takes between respawns")] public float Respawn_delay=1f; private bool RespawnInitiated = false; void Start(){ StartCoroutine(Respawn()); } void Update(){ if(Instantiated_GO!=null){ } else{ if(RespawnInitiated==false){ RespawnInitiated=true; StartCoroutine(Respawn()); } } } public IEnumerator Respawn(){ yield return new WaitForSeconds(Respawn_delay); Instantiated_GO=Instantiate(GO_Spawn,Respawn_position.transform.position,Respawn_position.transform.rotation) as GameObject; RespawnInitiated = false; } }