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 FallingObjectScript.
  2. Delete the line where you define the clip1 variable, and replace ...

Get Unity 3D Game Development by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.