|
Post by tomstales on Apr 30, 2021 11:05:27 GMT
Hi Guys, probably a very simple thing to do, however I couldn't find a solution yet. Maybe there is another thread and I am blind?
Anyway, I have a playlist and this is working well. However, I want to play a specific song on one scene, and after leaving the scene, coming back to the playlist. What would the best way to do this? Thanks!
|
|
|
Post by DarkTonic Dev on Apr 30, 2021 16:21:48 GMT
Obviously you will need your Master Audio game object to "Persist between scenes", so make sure that's on.
If you want something to happen when you leave the scene, you can attach an Event Sounds script to a game object that will be destroyed when you leave the scene, and use "Disabled" event to play a song or whatever you want to do.
|
|
|
Post by tomstales on Apr 30, 2021 18:49:23 GMT
Thanks for the answer. I now have my playlist muted in the specific scene and also start again in the next one. However, I seem to not understand how to play a sound...set up of the master audio is as follows, I have created a group for the sound:
And try to raise it here in another scene:
However it seems I am not using the correct name? I did read the doc but couldn't find where the actual group name is specified...
|
|
|
Post by DarkTonic Dev on Apr 30, 2021 18:54:01 GMT
The Group's name is what's shown in the mixer (first screen shot) - "PeaceSound".
The Sound Groups are actually chosen from a dropdown, not typed in. And you don't need to specify a Variation name unless you have more than 1 and want it to be non-randomly chosen.
You do have the correct SoundGroup chosen.
|
|
|
Post by tomstales on Apr 30, 2021 21:19:50 GMT
Ah, got it. Now I just need to destroy / stop the sound after the player leaves the scene to the next one (where the playlist starts again), but that's one for tomorrow
|
|
|
Post by DarkTonic Dev on Apr 30, 2021 22:28:56 GMT
Ok, well give me more detail and I'll answer when I see it.
|
|
|
Post by tomstales on May 1, 2021 7:14:04 GMT
Well, usually I would try and find out myself, but if you offer it and as I am in hurry to finish the game for a jam for this evening, Ill take the opportunity to be a bit lazy, ehem Attached Scene 1 and 2. What it should do is to 1) Pause Playlist and Play Sound "LastStand" 2) Scene changes 3) Resume Playlist and Stop "LastStand" However, I think the "LastStand" does not stop with the way attached..
.
|
|
|
Post by DarkTonic Dev on May 1, 2021 15:47:38 GMT
You need to use "Stop Sound Group Of Transform" under Action Type of "Group Control" to stop an already playing sound. You have it set up to actually play the sound again.
|
|
|
Post by tomstales on May 1, 2021 21:02:35 GMT
Sorry, I am probably acting like an idiot, but as logical as it sounds it doesn't work, the music is still playing...I created a group "eins" in the start menu that gets called in scene x (works, playlist stop -> resume also works), but when using the method described it still plays..
|
|
|
Post by DarkTonic Dev on May 1, 2021 23:04:15 GMT
Those are the settings (stop sound group of transform), but it be under the Disable event, not Start event. So that it will happen when the Scene changes, right? The Start event should still play the sound as before.
So,
Start: PlaySound Disable: PausePlaylist, and also StopSoundGroupOfTransform (you can add more actions, so this one will have 2).
|
|
|
Post by tomstales on May 2, 2021 11:21:07 GMT
I just found out it has something to do with the restart mechanism of the game, somehow. the first time it loads the level, it doesn't deactivate the sound. but when the player dies for the first time (the level reloads in that case), it gets deactivated. actually no idea why...but I think it's not too important as it was just a jam title, but it's strange nevertheless. I got the idea though now how this is working, thanks a lot
|
|
|
Post by DarkTonic Dev on May 2, 2021 18:58:33 GMT
No problem. Probably some race condition or lack of state that makes it not work in that case.
|
|
|
Post by tomstales on May 4, 2021 18:46:21 GMT
hey mate, just wanted to let you know that just using a playlist and playing specific songs though the controller worked so...much to learn with your tool but will have a lot of fun doing so
|
|
|
Post by DarkTonic Dev on May 4, 2021 19:21:35 GMT
Excellent. Well we're always here.
|
|