I want to open a menu Click a button and music Plays, When I leave the menu I still want it to play. When I open the menu again I want to click a button and that same audio stop. Please Can you help me?
I want to open a menu Click a button and music Plays, When I leave the menu I still want it to play.
play the sound and store reference to it somewhere that doesn’t die with the UI. Player controller stays alive the entire time game is running, for instance.
The widget can communicate with the player controller. An interface would be good for that, but you could cast to your player controller cast to get direct access to it for a quick test just to get things working.
Make it so that when you push the button you call a custom event that will toggle a boolean, and the boolean state can be used to play/pause the sound.
it’s a better practice to collapse the blueprint widgets instead of destroying them and re-spamming them, but in case you do destroy it put the audio into something permanent like the gamemode
So does the game mode option work with a button in the widget?
I added the is valid. the sound is valid and does play and I can stop it I just cant play it again once ive stopped it.
This is the blueprint:
I worked it out.
On Event Construct I play the sound than paused it.
When I click the play button it un pauses the audio and when I click the cancel button I pause the audio again.