O'Reilly logo

Unity 3D Game Development by Example by Ryan Henson Creighton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - the point of impact

We're finished tweaking the explosion, so you should delete the instance of the Explosion Prefab from the Scene view. The original stays safe and sound in the Prefab container in your Project panel. Naturally, we want this explosion to appear whenever we detect that the bomb has hit the ground. We've already put the logic in place to detect a ground hit remember that we're moving the bomb back up into the sky as soon as it drops below ground level. So it should be a reasonable hop, skip, and jump towards making that explosion happen. And luckily, it is!

  1. Open up your Bomb Script and add the following variable at the very top:
    var prefab:GameObject;
    
  2. Then, just after the code where we detect a ground hit, add ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required