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 - add the most important part of any spaceshooter

We're almost ready to close the book on the main functionality of our space shooter game. We can fire bullets and explodify enemy ships. Although it may well defy the laws of physics, a satisfying fiery explosion occurs in the oxygen-free vacuum of space. But there's just something... missing, yes?

Numerous studies have been conducted to determine the most scientifically accurate sound for a badass neon-green irradiated bullet being fired through space, and the results have settled unanimously on the onomatopoeic "pew". Luckily, we have just such a sound effect in our Assets folder, so let's get it going.

  1. At the top of the HeroShip Script, declare a variable to hold the "pew" sound ...

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