Time for action – mix it up a bit

One of my personal beefs about sound design in games is when the sound effects are too samey. In our game, hearing the same two sound effects over and over again is wearying. One of the things I like to do is to create a bunch of slightly different sound effects for the same event, and when the time comes to play a sound, I just choose one of them at random. This can really vary the soundscape of the game and keep your player from overdosing on the same sound effects.

You probably noticed that the SFX folder contained five versions of the smash and explosion sound effects. Let's learn how to set them up to play randomly:

  1. Open the FallingObject script.
  2. Delete the line where you define the clip1 variable, and replace ...

Get Unity 4.x Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.