I want a background music to play non-stop through Screen 1 and Screen 2. But once it switches to Screen 3, the music immediately pauses as a short sound effect takes over. After the sound effect, the background music shall resume from where it paused, instead of playing from the beginning. How do I code this? I've tried everything and need help.
Welcome Jazmine.
Since Player documentation tells us the following
Methods
Pause() suspends playing the media if it is playing.
Start() plays the media. If it was previously paused, the playing is resumed. If it was previously stopped, it starts from the beginning.
Stop() Stops playing the media and seeks to the beginning of the song.
Perhaps this would work:
- when you move from Screen1 or Screen2 to Screen3; Pause the music before you actually leave the Screen.
- in Screen3.Initialize use your short sound effect using Sound component, then
Start the Player. It might start playing again where you left off when you paused according to the documentation. - you might need to experiment. There could be a problem starting a Player on Screen1 or 2 from Screen3. I don't know if it will work.
Does that work? (I didn't test this but YOU can).