As you can see I am not very regular blogger. Maybe I don’t have anything to write about , or maybe it is language barrier , because as you know English isn’t my native language , or I may be a little lazy when it comes to writing this blog 🙂 . Anyway here I am and here is another not a tutorial part of my blog and I will write about sound .
Sound in unity , sound in game development. I don’t want to write about elementary settings and implementation. There are tons of tutorials and videos out there. Here What you NEED to know about game audio as a beginner in 2021! Unity3d or here Simple Sound Manager (Unity Tutorial) or just google unity sound 🙂
I want to talk about things, which took me a long time to understand. Or not so long but they aren’t so explicit . First one is just a small thing. In most tutorials I saw, they use Play() method of AudioSource (here for example some great sound manager tutorial and Play() method works in the way that if you call it again on the same AudioSource the first sound will be cut. It’s useful in some cases (background music) , but when you want to handle more sounds simultaneously with one (theoretically) AudioSource just use method public void PlayOneShot(AudioClip clip, float volumeScale = 1.0F); instead .
So I ended up with just two AudioSources in my SoundManager one for background music and one for all sounds and I was happy until I found out that this is awesome only for small games when all sounds came from one point in game world . So I dug a little bit deeper and found out that 3d settings in AudioSource doesn’t apply only in 3D space also it’s quite useful in 2D game (when you want to have more realistic sounds for example when you are going away from enemy the volume of sound became lower) and that ‘s the second big reveal 🙂 I found out just few months ago. (still learning as you can see)
There are other topics you have to think about when implementing sounds. Where to find sounds ? What to do when there is a lot sounds on screen ? How to adjust sounds ?
So here is my workflow. Not saying that this is best workflow out there, but its best I was able to come up with.
- I make all parts of my game without sounds all animations all effects etc. just all 🙂
- As I have everything I write down all sounds I will need (it is 170 sounds for my game in making)
- I find sounds . This step is very time consuming because I don’t have budget for sound artist I make all adjustments needed. I download free sounds from here https://www.zapsplat.com or here https://freesfx.co.uk . These are two best sites for free sounds and music in my opinion. They are free with contribution so read the licenses . I paid for gold account in first one so I don’t need to contribute by I will because why not 🙂 . For adjustments I use https://www.audacityteam.org its free and open source , you can use it on platform of your choosing.
- I group sounds by their importance. I use 5 levels. For example shooting will be most important and walking sound least. Here I will reconsider number of levels in the future. This is useful in case of many sounds on screen and unity has to choose which one to play.
- I have sound manager script as singelton with AudioSource for every level (priority setting in AudioSource) all Audio Clips are as variables here .
- Every GameObject I need to have 3D feature has its own AudioSource
- I call methods for playing sounds whenever needed some from animations some after gamer action some after collisions
Here is some short video from game I am making now … with sounds
And that’s it . 🙂 happy coding