[DEV] Sounds

[Note: Video has sound!]

During the holidays I’ve been looking into how to make a system that can play multiple sounds, can be accessed from all scripts and is easily maintainable.
To achieve this, I’ve made a manager that has a list of Audio Sources. These can be easily added and tagged, so they can be accessed through some simple functions in the script.
Since the manager is a singleton, this will also ensure that there’s always one and only one manager present in the scene.

I also added a functionality to pick a random sound if multiple sounds with the same tag have been added. This is often done in games to create variation for very repetitive sounds, such as footsteps, hurt sounds, and so on.

All there’s left to do to have all the sounds in our game, is to find or make them, add them to the manager, and call them in the corresponding scripts.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s