Dynamic Sound Group Creators

Dynamic Sound Group Creator game objects can be created from the Master Audio Manager window. You can use it to create temporary Sound Groups, Playlists and Custom Events by using its Inspectors and placing it in a Scene or Instantiating it later. It is usually used to set up per-Scene sound effects that will populate themselves to the Master Audio game object when they become enabled (note that an Activation Track in Timeline can do this) and delete themselves from it when they become disabled. Non-persistent game objects become disabled (and then destroyed) each time a new Scene is loaded, so this is an easy way to add temporary sound items to a persistent Master Audio game object.

 

Yes, you can actually place a Dynamic Sound Group Creator as a child Game Object of each prefab you have that needs audio. For example, place one on an NPC for everything it says and other audio it requires. When the NPC Game Object becomes enabled, its sounds are also enabled. This works even if you have multiple instances of the NPC in the Scene. Master Audio will not delete and disable the sounds in the DSGC until *all* instances of the prefab are disabled.

 

A second scenario these come in handy for is when you're not sure which Audio Clips you will use before runtime - like if you wanted to change to a "audio skin" of different fire, jump, and run sounds based on user input selection for example (maybe for different player characters). Prefabs with DSGC's could then be Instantiated to put these sounds into the Master Audio game object at runtime.

This second approach is also a great way to do Localization! You create a DSGC for each supported language, all containing Sound Groups of the same names but with different audio for that language. Then write a few lines of code to detect the chosen language and Instantiate the DSGC for that language. Done!

 

The Inspector looks like a stripped down version of the Master Audio game object, and is basically a mini-Master Audio game object with most of the sections from it.

 

 

Top Section

  1. Items Created When? This has a couple choices:
       
    • First Enable Only: (The default) Only the first time the DSGC is enabled, it will create the sound items in the Master Audio game object.
    •  
    • Every Enable: Every single time the DSGC is enabled, it will create the sound items in the Master Audio game object.
  2.  
  3. Error On Duplicate Items: Defaults to checked. If you turn it off, no errors will be logged for Sound Groups, Playlists, Custom Events and Buses that already exist. They still won't be created if they exist. This is useful if you have more than one of the same Dynamic Sound Group Creator but don't want to see errors when you already created the items with the first one that spawned.
  4.  
  5. Auto-create Groups: If you check this, the Sound Groups specified in the lower section will be created in the OnStart method of the script. If you do not check this box, you will need to call the CreateGroups method yourself from a script.
  6.  
  7. Auto-remove Groups: If you check this box, the Sound Groups you create are temporary and will removed when this object is destroyed (normally this will be when the Scene changes). You can manually remove the groups by calling the RemoveItems method yourself from a script.
     
    Note: do not check this box if your Master Audio game object is not persisting and will be destroyed when the Scene changes as it will show false errors in the Console.
  8.  
  9. Fire 'Items Created' Event: If you check this box, you can select a Custom Event to fire right after all the audio items are created. This is good for making sure that the items have been created before playing a sound or starting a Playlist.

Collapsible Sections

  1. Dynamic Audio Ducking: This is for specifying Ducking settings for the Groups you create in this game object. Works the same as the Ducking section in the Master Audio game object.
  2. Dynamic Group Mixer: Here you specify settings for any number of Sound Groups to create. You also have full Variation support. This section looks and functions exactly the same as the Group Mixer on the Master Audio game object.
       
    • Buses here have an additional choice in the dropdown labeled "Existing Bus" which allows you to use a Bus that's already created in the Master Audio game object. You must type the name in though, so copy it from the Hierarchy or Project View.
    •  
    • You can click the gears icon (settings) to edit the Dynamic Groups. Then you can click the gear icon there to edit the Dynamic Variations of the Group. Full Filter FX controls are under the Variation. To save on memory usage, Filter FX components are deleted from the Dynamic Sound Group Creator's game objects as soon as they are added to the Master Audio game object at runtime.
  3. Dynamic Playlist Settings: These are exactly the same as the Playlist Settings in the Master Audio game object, but here you only create temporary dynamic Playlists.
  4. Dynamic Custom Events: You can also create per-Scene Custom Events. The controls are identical to the controls in the Custom Events section in the Master Audio game object's, except that events you configure here can be auto-deleted when the Scene changes if you set it up that way.