- Home /
How do I make a explosion happen at a certain time?
I am using the detonator package and I need it to explode at a certain time or time cycle not on start. I know you make the explodeOnStart = false; then I know you have to call to Explode() but how do you do this? I am new to unity and scripting.
Comment
Answer by coastwise · Dec 06, 2012 at 02:03 AM
If you want it to happen after a specific number of seconds you could use a Coroutine like so:
void Start () {
StartCoroutine( ExplodeInSeconds(3) );
}
IEnumerator ExplodeInSeconds(float delay) {
yield return new WaitForSeconds( delay );
Explode();
yield break;
}
Note: this is C# script. If you were doing javascript it would be a bit different
Your answer
![](https://koobas.hobune.stream/wayback/20220613085024im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Tank Missle Colide then explode and destroy 1 Answer
Detonator: How to differ power from size 1 Answer
Meteor Explosion, Destroy on Impact 2 Answers
exploding a car 4 Answers