Eggys Games

Sound Variance

Posted on by Eggy

So a neat little trick when adding sound in games is randomising the pitch so one sound effect turns into 10. This means the user will always here a slightly different tone and it makes it feel like their is more sound effects added and gives it a more realistic effect. The volume is also using Unitys audio listeners to make the sound volume lower when you are further away, giving a proper ambience. The code below highlighted shows this, you'll also notice the sound doesn't activate unless the object is hit at a higher speed, this is good for only activating the sound effect when you push it over or it falls rather then simply touching it gently.