|
Post by DarkTonic Dev on Nov 24, 2023 6:13:25 GMT
Glad to hear you're making progress.
Ultimately, it will be easier on you if you don't navigate the Master Audio things using the Hierarchy. It will get unwieldy real fast. Best to use the Mixer section, where we have Bus filter, Sort by bus, Text Group filter and more.
The way to make the music play in a new scene is not the simplest, but it works. 1) Your DSGC should fire a custom event when it's done creating the items. 2) You put an Event Sounds script somewhere in that new scene that listens for that custom event, then it plays whatever song you want.
If you want a certain keystroke to play a sound, that's probably a 2 line script. I'll add it to the list though.
The single folder thing - I understand, but those are the special folders we need to use. Unity looks there for those things.
1) Editor Default Resources is the place icons for our Inspectors are stored, that way they are guaranteed to not take up any room when you make a build. 2) Gizmos is the special folder for in-Scene Gizmos. 3) Resources is where Scriptable objects go. 4) Assets/Plugins - code that "doesn't change" goes in Plugins. Not in Assets. 3rd party code should not recompile every time you change your game code. This is very important and often overlooked.
I'll even go as far as to say whichever other plugins you're using that aren't using these folders as designed are doing it wrong. In short, Master Audio shouldn't be the only one creating those folders. They should already be there if the authors did it proper.
Thank you, -Brian
|
|
|
Post by cheopisiv on Nov 24, 2023 15:19:56 GMT
The only other Asset I have installed is TextMeshPro which is all in their own folder. I suppose Unity devs can have ties into the engine that other developers don't have so maybe that's why theirs is in one folder Once I preload all my sounds in the MA asset, I create a MA prefab and then I create a DynamicSoundGroupCreator and import my sounds to it through the SoundGroupOrganizer. I then delete the SGO and create a prefab of the DSGC that I use in all scenes. When adding these sounds into the game, I connect an event to some object in the game ie: Paddle and Ball since they're in every scene and my sounds trigger on collisions. I make those into prefabs and drag them into every scene as well as the DSGC. I'm not actually accessing anything directly in the hierarchy aside from copying sound / song names to paste into the event calls. My music is set to play on the Start action on an object in each scene. I don't see how the DSGC firing a Custom event and then adding that event to an object in the scene to play the music is any different that using the DSGC and firing the music on the scene/object start event. Both methods still appear to use the DSGC and require the event be added to something in the scene. I played with the Custom Event system but couldn't get my sounds or songs to fire from the Custom triggers. The docs are full of info but pretty hard to navigate as I have to keep bouncing between pages and there doesn't seem to be any concise tutorial in there on doing this. Is firing the standard event and playing from the Mixer more resource heavy or inefficient than a Custom event firing the same sound? If using a Playlist, then I have to load in another element altogether (the Playlist controller) and that doesn't seem to hold any values in the editor unless I have the MA Prefab in the scene as well. I understand it destroys itself every scene load, but this just seems like a bunch of extra complicated steps to make the same thing happen. I'm sure there's better practices here and I'm trying to understand why I should be doing things in different ways, but I'm all about learning the most efficient way to do them. Being new to all of the systems including Unity itself has it's share of roadblocks and learning curve.
|
|
|
Post by DarkTonic Dev on Nov 24, 2023 21:23:30 GMT
Ah ok, I was routinely using 20+ code plugins back when I was working on games, and exactly zero of them used the correct folders. It was pretty infuriating when I learned about it and tried to convince other authors to do the same so we didn't have to have users do things like move a whole plugin from Assets to Assets/Plugin, for perspective. But someone had to start doing the right thing to get the ball rolling Yes, your workflow seems correct. That's good. I prefer to do the Custom Event with DSGC so that it's guaranteed to exist (the song) at the time it's told to play. In case there was any race condition. I'm not really sure what's the alternative you're suggesting. My method also works for DGSC's that are activated at times later than scene start, which is probably why I use it. You could show me screen shots of your custom event and all that so I can look for anything obvious. Custom Event has basically no effect on performance, it's very optimized. Yes, the Playlist Controller is only there to host Playlists, and those are only created in MasterAudio and/or DGSC game objects. For this reason, usually Playlist Controllers will persist scene to scene. What destroys itself every scene load? If there's a new Master Audio game object in the scene and the old one is persisting from a previous scene, the new one is destroyed. -B
|
|
|
Post by DarkTonic Dev on Nov 25, 2023 16:59:25 GMT
The reason we don't detect keys in Event Sounds is so we don't have to have an Update method that runs every frame. Most users have dozens and dozens of Event Sounds in their project and that would kill performance. FYI.
|
|
|
Post by cheopisiv on Nov 26, 2023 0:31:49 GMT
That makes sense. I'll be coming back to this in the near future, but for now I'm moving back to project mode to get some things done. Appreciate the help so far.
|
|
|
Post by DarkTonic Dev on Nov 26, 2023 2:02:45 GMT
Ok, no problem. I appreciate the review you left. See ya soon.
Brian
|
|