Unity Learn home
View Tutorial Content

Sound Effects Scripting

+10 XP
45 Mins
The Unity Editor enables you with the tools to work with scripts in the C# programming language. You can easily incorporate and attach custom script components onto GameObjects, which can control their functionality in any manner of customization.
In this tutorial, you will learn how to script with basic C# commands to trigger and control audio sound effects in your Scene, as well as customize certain audio properties such as incorporating conditional statements and elements of randomization.
You will learn how to use C# scripting to trigger and customize GameObject and sound features including:
  • Scripting a character controller to shoot cube projectiles.
  • Scripting a sound effect to play when shooting projectiles.
  • Scripting a smashing sound to play, when blocks are hit.
  • Scripting variances in pitch, by incorporating randomness.
  • Scripting a conditional statement to play different sound clips, depending on how hard the blocks are hit.
By the end of the tutorial, you will have a solid understanding of how scripting with audio works, and how easy it is to create customized audio events.
Select your Unity version
Last updated: April 14, 2022
Also included in
Sound Effects Scripting