I am trying to make a cool looking explosion, but when I instantiate each phase of the explosion it all happens at once.
How would I delay each instantiation?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyByContact : MonoBehaviour {
public GameObject boom;
public GameObject boom2;
public GameObject boom3;
public GameObject playerBoom;
void OnTriggerEnter(Collider other) {
if (other.tag == "Boundary") {
return;
}
Instantiate (boom, transform.position, transform.rotation);
Instantiate(boom2, transform.position, transform.rotation);
Instantiate(boom3, transform.position, transform.rotation);
if (other.tag == "Player") {
Instantiate (playerBoom, other.transform.position, other.transform.rotation);
}
Destroy(other.gameObject);
Destroy(gameObject);
}
}