I've been messing around with this for the past 4 hours. I can get audio to play in a single scene using multiple methods and that works fantastic but I can't figure out how to configure it to work across scenes.
I've followed the video (https://www.youtube.com/watch?v=dj7WYQ64jF0) step by step but when I try to load things up in the new scene, I don't get any options to 'Import' the list from the main MA instance. I've looked at the spaceship example scenes but they don't really show anything as the interaction between the two scenes and the online documents basically just explain what the features and functions are supposed to be but don't seem to be much more than a generic tool tip. What am I missing?
Post by DarkTonic Dev on Nov 21, 2023 14:21:17 GMT
We included a Bootstrapper example scene, which is _BootstrapperDemoScene, and goes to _AfterBootstrapperScene.
There really is nothing more to it than clicking Persist Across Scenes under Advanced Settings, as far as getting the sounds under MasterAudio to play. Then you use Dynamic Sound Group Creators to do per-Scene sounds. -Brian
I'm sure I'm just missing something very simple. One thing I noticed is that when I add the separate prefab Audio Player element it shows up as an item in the hierarchy but in the demo scenes it shows as a prefab (blue). Other than that, I have the box ticked for the MA main program to persist and I can get sound in the starting scene no problem but I get nothing in the next scene. Adding the two elements to that scene gives me options to build everything again but it doesn't pull from the starting scene list. I just see messages that I have nothing set up.
I'll put together a few screenshots of my process when I get back to my dev comp later this eve.
I don't have it in front of me so I don't know the terminology from within the system, I'm talking about the first step from the MA main screen where you add the main controller function and the player function. Basically button #1 and 2.
Edit: Master Audio Prefab and Playlist Controller Prefab.
Ok, I can explain what I'm doing from the online docs.
I have a main control scene (bootstrapper) that currently persists across all my scenes and loads/unloads them as needed. It has all my control code for the game (basic brick-breaker clone) and loads the different sound clips and a background music track. The sound clips are carried through all scenes and my background is unique per scene. I disabled the current audio script and am trying to work with MA to replace it.
I load the Master Audio Asset and from that I load in Master Audio Prefab and Playlist Controller Prefab to my scene. From there I build my sound list and tick the "Persist Across Scenes" box.
Then I go to my first load Scene and add the Dynamic Sound Group Creator Prefab and the Sound Group Organizer prefab. And that's where I get hung up. I don't get an 'Import' button
I must have been half asleep when working on this last night. Just went through Vid 2 again (Master Audio: Per-Scene Sounds and Workflow Tools (HD)) and it seems I was missing some crucial steps. MA is doing all the right things now on my first loaded scene after the bootstrapper so now I just have to get time to sit down and set it up for all the scenes. All of my SFX sounds will be scene to scene so I'm hoping that'll transfer easy...should I use a prefab for the objects needing the sounds attached ie: ball, paddle and bricks? I'm thinking that's most likely the way to go to save having to rebuild the collision2D sound events on each scene. The only thing I need to change is the background music on each new scene load and it appears that's been covered at the end of the video.
Had the sounds working on the one scene but they won't move to the next scene except for the main background song; and I can't get the Button Clicker to work in any scene. I think I'm done with this one. I'm sure it works fantastic for some folks but it's just not jiving with me. Going to move back to my Audio Manager script and code things in manually for now.
For multi-scene you'll just need to create DSGC prefabs with the sounds for that Scene. Then you can trigger sounds with the Event Sounds script, no coding needed most of the time. Button clicker is actually for NGUI, which most people aren't using anymore. Event Sounds can do all that and more with Unity GUI.
Is that with Button Clicked or Event Sounds? Are they supposed to play the same Sound Group when clicked? If so, as I was saying, you probably need to increase the Voices field of the Variation in that Sound Group that you're playing. Those always default to 1 which means that only one voice of the sound in question can be played simultaneously. If you turn on "Log Sounds" in Advanced Settings, the Console will tell what needs to be done when it doesn't play. There are several reasons, this is the most common.
I figured out the issue... My Start button loads a new scene and the SFX attached to the Click event is skipped on load even with the MA persistent. Not a big deal as I can load the sound with the new scene instead or delay my scene load.
I've played with a few things and barely scratched the surface, but I think I finally got the hang of this! I'm loading my groups ie: SFX and Music in the main mixer and adding the clips to each group. I'm not using them as actual variations, but it lets me stay organized in the hierarchy with folders. I'm calling the sounds on prefabs that I can load into each scene to replace the static items and carry my sounds forward. Works like a charm.
I couldn't figure out how to make my music load a different song on each scene with the Playlist so I just used the Group Mixer and set them to loop, then attached the song to an object in each level with the same Event Sounds Component as the SFX. This isn't any faster than doing it the old way with Unity sounds but if there's some way to do it using the Playlist feature that I'm missing, then I'm all ears.
Other thoughts: Key stroke events. I searched the forum and it appears Keystrokes can't be used to trigger sounds. I have one event using the spacebar that triggers a sound through my code. Being able to do that through MA would be handy.
The Plugin loads 4 different folders into the Assets panel. Gizmos, Editor Default Resources, Plugins and Resources. I'm a bit of a neat freak and it breaks my brain to have a bunch of folders for one process. It'd be nice if the asset deployed everything into a single folder.