I am having an issues, I have a particular sound effect that plays once a person accesses the title screen and main menu, however when the player goes into a different menu I would like for that effect to turn off and then a new track plays in the new screen. In my case, the password screen. I can’t seem to figure out this behavior in the blueprint editor to get the title screen/main menu to turn off when a player goes into a different screen and then resume once the player goes back into the title/main menu screens.
I think you can’t stop those Play Sound 2D nodes.
A simple solution: drag your tracks to your level and use Play and Stop nodes with Event Construct and Event Destruct.
MAIN MENU UMG
Event Construct —> Play [Audio Component 1]
Event Destruct —> Stop [Audio Component 1]
PASSWORD SCREEN UMG
Event Construct —> Play [Audio Component 2]
Event Destruct —> Stop [Audio Component 2]
EDIT: If you can’t use your tracks with this system: attach your tracks to an actor as Audio Component variables, drag this actor to your level and use a Cast To Actor from your UMG…now you have your Audio Component variables in your UMG.
P.S. Remember to uncheck the “Auto Activate” option.
Yeah thanks Diat it’s for UMG not the level, but I am going to try it and let you know.
Yeah, you can do it in many ways depending on your needs…
In this example I use a Game Mode’s Audio Component:
This is the Main Menu BP [UMG] where I store “Track 1” to an Audio Component variable and play it; when I destruct the UMG, I GET the variable and stop it. You can use this method wherever you use that Game Mode.
I think the best way is to create a cue then add your sound in a specific Sound Class, then set volume to 0 of that sound class .
UMG Sound Class, In Game Background Sound Class, and what else do you want .
And If you want a slider :
Drag a slider :
At Value add a function :
Then in Function :
Then : in Event Graph of you Widget :
I know this is an old post but this is the way i did it.
Right click, Create Sound 2D (Select the sound you want) then Promote it to a variable, I named mine BGM, then drag from the Return Value of your BGM and type Play.
Then Get the BGM reference that you have, drag from the Return Value and type Stop.