Download

UMG Sound off/on in blueprints?

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.01.JPG
a4d6e3aef9026efff3033f1b91f52ea91d6968b3.jpeg

Hi Darkmanx!
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.

EXAMPLE

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:

a23c9348b3d47b8e0deeb230340c786e198bad4c.png

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 .
96f76a8183f591321d547247f6ac5516abae7898.png
55de2699d2e1734eadb61919c2cf6ed848732d8f.png

And If you want a slider :

Drag a slider :
4898e101bfa16c9d235f187c4243b6127df7608f.png
At Value add a function :
7f2d19e9bf77b2503dd075b8f65227d53ed30f1f.png
Then in Function :
fed7d04daea0f38a5c3afda1accc3a5826257438.png
Then : in Event Graph of you Widget :
fe2446c131ace2970557071eada9267825232dab.png

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.