Simple Sound Effect with Randomized Pitch - Beginner Unity

Опубликовано: 19 Март 2026
на канале: Game Code Library
5,354
213

*FREE code files on my Patreon*
Hi! In this video we'll look at how to get a single sound effect to play when called from our code! We'll also set it to have a random pitch to keep things interesting.

In the future we'll set up a sound manager for multiple sound effects handled appropriately - but this is a quick and easy way to get your games playing sounds! Handy for a quick game jam ;-)

All source code for all videos I have made and will make in the future can be found on my Patreon:
  / gamecodelibrary  

Previous videos used to make this platformer:
   • Platformer Player Movement - Unity 2D  
   • Easiest Player Tracking Camera - Unity 2D  
   • Easy Tilemaps and Dynamic Auto Tiling - Un...  

Spritesheet used: https://rottingpixels.itch.io/nature-...
Get sound effect from Chiptone: https://sfbgames.itch.io/chiptone

I'll be posting new videos every Friday, so be sure to subscribe to see what kind of adventure we can go on together!

If you have any suggestions, feedback or questions, be sure to comment below! Any opinions will help me out on this journey ♡

0:00 - Intro
0:05 - Chiptone.io
0:11 - Deciding where to hold our audio source
0:32 - Audio Source Setup
0:45 - Script to Play Audio
1:09 - Audio Working!
1:14 - Randomize Pitch
1:42 - Outro