Search Unity

Audio Questions about Unity Audio

Discussion in 'Audio & Video' started by BlueSin, Dec 8, 2018.

  1. BlueSin

    BlueSin

    Joined:
    Apr 26, 2013
    Posts:
    137
    So I am working on a project right now that is approaching the point where I need to start adding audio. I had some questions about how it works. For the record my game is top down 2D if that has any relevance here, I don't know really much of anything about audio stuff.

    So my plan is to have my game manager class manage audio (or I could create a separate audio manager class). The game manager object is a DNOL object initialized on game launch, and will have 2 game objects attached to it: BGM Audio Source and SFX Audio Source. The game manager will hold internal references to the Audio Sources. Each map (scene) in the game has a MapData class that contains a load of information about data specific to that map (fish that can be caught there, BGM music to be played (if any), map size, etc.)

    So when the map loads, the MapData class will reach out to the GameManager class (only if it has a BGM tracklist that is not null) and give the GameManager the tracklist. If the tracklist is not the same as the GameManager's current tracklist the GameManager will then stop the currently playing BGM and start playing the new tracklist on shuffle. Any objects using SFX will reach out to the GameManager and tell it to play the clip associated with it on demand.

    I plan to use a Master mixer with BGM, SFX, and Reverb child mixers and allow the user to change the Master & other mixer volume levels through the options menu. I plan to add additional audio sources and mixers later for ambience (birds singing, ocean waves, etc.) and stingers as well.

    So I am not sure if that is how Unity works or not, and that is why I am reaching out here. So my obvious first question is, will this plan work? Secondly do I need multiple SFX Sources or can I be playing multiple sound effects through a single source? Not sure if I try to play several audio clips through the same audio source if they overwrite each other (which is how it seems like it must work) or if they will play both.

    Any and all help is appreciated, thank you!