|
Post by hipsterdufus on Nov 20, 2021 21:42:38 GMT
Hey there, I have a couple more questions I had about things.
I'm wondering if there's an easy way to fade out and stop my music. I am using the stop method from code but it stops abruptly so there's no fade out happening. I guess I could just start another track in the playlist and get a crossfade effect automatically but I think I'd like to stop the music completely (with a fade out) and then start another track after a few seconds. Is there an easy way to do that? I know there is a fade out method but if I use that will I need to remember to fade the volume back up every time I start another track?
Another question is if I have an object that constantly is emitting a sound (with a looped clip), how do I stop the sound later? I'm thinking I'll have to start the sound in code and get a reference to it, then I'll have to stop that reference later at some point. Is that the best way?
And finally, if I have some rain ambience that is always playing should that typically be a sound group? Right now I have it as a sound group on an "Ambience" bus. I'd like to deafen that sound a bit when the player goes indoors. Do I have to manage the volume to do that or is there a prefab I can add to the mixer to deafen it? I'd rather not mess with the volume because I'd like that to be tied to the player's volume setting in-game. Any tips?
|
|
|
Post by DarkTonic Dev on Nov 20, 2021 22:56:07 GMT
Right. Well an easy way to think about it is that Stop means stop (not fade and then stop). Just take them literally. There are fade commands on Playlist Controllers you can use. If you're using Event Sounds, you can use that for it. Either way, you will want to actually stop the Playlist after the fade reaches zero. There's a callback method where you can add that code to stop the Playlist. You can also turn on checkboxes in Advanced Settings that automatically stop Playlists (and other things) when a fade reaches zero automatically.
#2. Correct, although there are multiple methods. To stop a sound later, you either hold a reference to it when you play it (look for the method names that don't end in "AndForget". i.e.
var psr = MasterAudio.PlaySound3DFollowTransform("Jump"); // later, stop it. psr.ActingVariation.Stop();
Another method is to not hold a reference and just stop the Sound Group FOR the Transform. This method has zero garbage collection so it's better if you can get away with it.
MasterAudio.StopSoundGroupOfTransform(this.transform, "Jump");
#3, yes it should usually be a Sound Group. You could use the Occlusion feature, which may work for that. Or you could have an "Outside Ambient" bus that you fade down when the player goes inside, and then the opposite when going back outside. You'd also have an "Inside Ambient" bus potentially.
-Brian
|
|