A downloadable tool

Download NowName your own price

A couple scripts I threw together for the last jam I did, this AudioManager plays sound effects by choosing an available AudioSource from an AudioSourcePool. It's meant to get you up and running quickly for prototyping and such. If you have no need for spatial sound effects, it could be the only audio solution you need!

There are 10 sources in your pool by default, simply increase or decrease the amount to however many you would like. There is also the option (on by default) to have the AudioSourcePool create a new AudioSource object if all current pool sources are currently in use. Careful with this functionality, if your logic makes too many requests in quick succession you could create an unreasonable amount of pools! Now that I think of it, it probably would've been good to put a cap on this, but I didn't, so, good luck :D

AudioManager is a singleton, so you can request audio from anywhere in your code by asking the AudioManager.Instance. It has two functions, PlayClip(AudioClip) and PlayRandomFromArray(AudioClip[]) which are self explanatory. There is also a PlayMusic function and the beginnings of logic for music choice on scene load that you'll need to finish yourself if you want to use that functionality (in OnSceneLoaded, I've included a switch case example from my own project but commented it out).

NOTE: These scripts are in their own namespace, so be sure to put 'using BATTLECAT;' at the top of scrips you want to talk to them.

If it helps you, and you have the means, I hope you'll consider donating or buying me a Kofi <3

Good luck making your games!

-

Background Image by: [freepik]

Updated 9 hours ago
Published 1 day ago
StatusReleased
CategoryTool
AuthorMILKSHAKEBATTLECAT

Download

Download NowName your own price

Click download now to get access to the following files:

BATTLECAT_AudioManager.zip 5.8 kB

Leave a comment

Log in with itch.io to leave a comment.