Hi, I have an AudioManager with basic methods for e.g. PlayOneShot, StopInstance etc. I often times need functions for specific sounds with some additional logic, like PlayFootStepsSound. Should I put these functions into the AudioManager or keep them in the gameplay logic scripts? Also, I need to store the event instances somewhere. Is it better to store them in the gameplay scripts to keep the AudioManager clean?
I am worried things will get messy when the project grows in size, so I am trying to decide on a structure now. Help is much appreciated!
It really depends on your project setup, so there isn’t a single “right” answer here.
That said, I can share some general recommendations that usually scale well:
Let your AudioManager handle global tasks such as loading banks, playing one-shots, or setting global parameters.
Keep gameplay-specific audio methods (like footsteps, engine sounds, or weapon fire) close to the system that triggers them. For example, a FootstepAudio component on the player.
If an event needs to persist and update (for example, looping or parameter-driven sounds), store its EventInstance on the object that owns it. If it’s just a short one-shot effect, simply call PlayOneShot().