|
Post by brothaman on Feb 22, 2018 12:21:39 GMT
I have one playlist which is my Menu Music. Another playlist which is my Gameplay Music. My Gameplay playlist has multiple tracks, and I want to randomly pick one to play, then loop on that track for the entirety game session.
I noticed in the tutorial vids that if I "Played Next Clip" in the Sound Event, of a track within the same playlist controller, it will crossfade automatically. For my use case, I can't have my gameplay and menu music share the same playlist because I want to play a track at random that's not the Menu Music track.
Any recommendations how to do crossfade from one playlistcontroller to another? I have a few ideas but wanted to make sure I wasn't going to over engineer this or I'm possibly just taking the wrong approach all together.
Thanks!
|
|
|
Post by brothaman on Feb 22, 2018 12:50:27 GMT
Nevermind, I figured it out. I added two actions two my Sound Event. First was to "Fade To Volume" to 0 on the Menu Music. Then second action was to "Play Random Song". Had to play with the "Fade Time" a little bit to get the right value that worked for my use case, probably will be different for others. Also changed the "Fade Settings" on the MasterAudio gamebject to stop audio of PlaylistControllers when set to zero volume. Attachments:
|
|
|
Post by DarkTonic Dev on Feb 22, 2018 15:58:13 GMT
Correct
|
|
ordinov
New Member
Posts: 1
Posts: 1
|
Post by ordinov on May 27, 2022 23:07:57 GMT
I didn't want to add a Sound Event component for this simple task (login screen playlist vs actual game playlist) so I'm using a completely manual approach (and it works): IEnumerator FadeChangePlaylist(string newPlaylist) { float cfTime = MasterAudio.SafeInstance.MasterCrossFadeTime; yield return new WaitForSeconds(cfTime); FadePlaylistToVolume(transform, 0f, cfTime); yield return new WaitForSeconds(cfTime); StartPlaylist(transform, newPlaylist); FadePlaylistToVolume(transform, 1f, cfTime); }
|
|
|
Post by DarkTonic Dev on May 28, 2022 0:00:01 GMT
Cool, that works as well.
By the way, there is no overhead for the Event Sounds component (no code that runs every frame), so use as many as you like.
|
|