So, I want different music to play in the main menu interface when I click on one of the submenus within it, and visa versa, meaning that when I click either into a submenu or out of it and back to the main menu, the music track for the previous menu stops playing, and the currently-opened menu starts playing its music.
I am trying to do this in the main menu widget because it is a user interface but I cannot create an audio component to reference the music I want to stop. Here’s my current code:
Hey @Impudent_Swine ! How are you?
I’ve been trying some things to do what you are asking and I think I found a good way to do it.
It consists in create an Actor to work as a Music Manager and spawn it using a custom Game Instance, which ensures we will be able to access the actor from our Widgets. That Actor will have functions to play the music, and we will call those functions from each Widget. Here I go with a better eplanation:
-
Create an Actor (I called it Music Manager) and add as many Audio Components as Menus you have.
-
Configure each Audio Component with its corresponding music, and disable the Auto Activate option.
-
Create the functions to play/stop each corresponding Audio Component.
-
After that, create a new Blueprint from class Game Instance and spawn the Music Manager in its Event Init.
-
Setup your new Game Instance by going to “Edit”, “Project Settings”, and searching for Game Instance. (You will need to restart the engine after this to be able to use it)
-
With this, you should be able to call the functions from your Widgets.
And that’s it!
Let me show you a video of it working:
Hope it helps you!
1 Like
So I made the Menu Manager actor blueprint and then the game instance but I don’t have the “Event Construct” node in the new game instance though I thought it was supposed to be there automatically.
Sorry about the confusion. I am still a noob at this and this is the most coding I’ve ever done before.
Hello again @Impudent_Swine !
Don’t worry, let me explain it better 
The “Event Init” is part of the Game Instance and you should add it manually.
Regarding the “Event Construct”, it is an event that is included in the graph of all your widgets, not in the Game Instance.
That should be it!
1 Like
I think I got most of the code down and am starting to understand the nodes but while the music plays for each menu like its supposed to, I cannot get the music to stop when switching menus still. I know it’s something simple and stupid that I’m missing, which is usually the case for me here. This is my code for the menu music functions and I made two other equivalent setups for the other menus.
Also, I think I’m stupid.
So, I put all of these nodes into the Main Menu widget, but my other menu widgets don’t have anything pertaining to sound files. Here is what is in my Main Menu related to the menu interactions and music
I’m wondering if the problem is that I am trying to control everything from the Main Menu widget and the Music Manager.
Noo!! Don’t be that harsh with yourself!
You are learning and that is MUCH MORE than a lot other people is willing to do 
Lets try to find out the problem!
First of all, I think you are not removing the previous widget when you open a new one. Fpr example, you should remove “Main Menu” when you open “Nessy” before adding it to the viewport. Something like this:
Another thing I can see in your screenshots is that you are still trying to play and stop music from your Main Menu. You don’t need to do that anymore, as you can control that from your Music Manager usgin the corresponding functions. I highly recommend you to do it in each Widget’s “Event Construct” as shown below:
You don’t need to stop the music manually, as you are already doing that inside each function on your Music Manager.
Additionally, if you wan to add fade effects to the music, you should do that inside each function in the Music Manager, not in the widgets.
Let me know if that works! And keep learning, you are doing it great 
1 Like
By the gods I got it to work! Thank you for the assistance.
1 Like