Music to Fade on Button Press

Hi,

Currently music starts when the ‘Main Menu’ Level starts, which is just a Main Menu widget for this level.

When I click on a button, I want the music to fade over 3 seconds as Level 001 loads after clicking the ‘Start’ button.

The first image is the Menu WIDGET blueprint click events for ‘Start’ and ‘Quit’
The second image is the Menu Widget LEVEL blueprint which starts the music.

The main issue as I see it, is that the MUSIC and the BUTTON click event for ‘Start’ are in two different blueprints, as I’m extremely new to development, I’m not sure what I should do in order to have the MUSIC fade on the 'On Clicked (Button_0) event.

WIDGET blueprint click events for ‘Start’ and ‘Quit’

Menu Widget LEVEL blueprint which starts the music.

1 Like

Make this a variable

image

Then, when you fade out the menu, you can

image

Thanks for your help!

Error message “Blueprint Runtime Error: “Accessed None trying to read property FadeMusic”. Node: Fade Out Graph: EventGraph Function: Execute Ubergraph Main Menu Blueprint: Main_Menu”

I converted the Spawn Sound 2D into a Variable called ‘Fade Music’

I then copied the Variable from the Level BP to the Widget BP.

But it doesn’t seem to understand the Variable across BP’s

Are these two different widgets?

One is the Level blueprint and the other is a Widget blueprint for that level

Easiest way, is to just play the menu music, from the menu widget. That way, you have the variable right there.

Otherwise, you have to pass the variable into the widget.

Okay so I have the music in the widget now so it understands the variable but the music doesn’t start

I assume nothing is calling ‘play music’.

You want to play the music when you open the menu, so

Excellent, that’s working now, thanks mate!

Working BP inside Main_Menu widget

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.