Got a problem with this… Destory(ob) never fires
private Object ob;
void OnTriggerEnter(Collider otherObject)
{
if (otherObject.tag == "Player")
{
renderer.enabled = false;
Vector3 pos = this.transform.position;
Player.playerScore += Worth;
Destroy(this);
ob = Instantiate(deathPrefab, this.transform.position, this.transform.rotation);
StartCoroutine(Delay());
}
}
private IEnumerator Delay()
{
yield return new WaitForSeconds(5);
Destroy(ob);
}