public IEnumerator RespawnObject() { yield return(new WaitForSeconds(respawnTime)); currentObject = Instantiate(objectPrefab, transform.position, transform.rotation); despawner = currentObject.GetComponent <Despawner>(); despawner.SetSpawner(this); }
void Start() { currentObject = Instantiate(objectPrefab, transform.position, transform.rotation); despawner = currentObject.GetComponent <Despawner>(); despawner.SetSpawner(this); }