Casting diffuclty: What exactly am I doing wrong
Hey all, I hope everyone is well.
I get most types of casting, like when something crosses a trigger box, but I've been struggling with figuring out how I'm supposed to target cast. I've made a serious effort to learn this and I'm just missing something. Here's what I feel like should work, but isn't.
On event beginplay, I spawn a UMG menu, but I do it from my main actor. It's important that the menu construction happens after certain things with the main actor. I assigned the menu to a widget variable called "Start Menu Widget".
On event construct, I have the start menu spawn some menu music.
I spawn an options menu from the start menu when a button is hit
And finally I want to be able to turn off music from an action in the options menu. According to the UE4 documentation located here, I believe I should be able to do that by target casting. Below is my attempt.
I would REALLY appreciate anyone willing to advise me on what I've done wrong syntactically. I have been at this for a very long time, and my failure to make this work is stressing me out. What goes on the other side of "target". Am I even close to doing this right? PLEASE, anyone, at the very least, point me to reading material that is clear, although, actually telling me how to solve this specific problem would just be dapper.
So your hierarchy is as follows:
And you want the Options Menu to turn off the music the Start menu created. So what I would do, is create a variable of type "UMG Menu" within the "Options Menu", set it to instance editable and expose on spawn. Then when you spawn the options menu FROM the UMG Menu it will ask for a reference object pin for this "UMG Menu". You can simple give it a reference to "self" since the UMG menu will spawn the options menu. Now from the options menu, you will be able to drag out this "UMG Menu" reference and access the music variable you created. Once you have the music variable you will be able to stop the sound using a button in the options menu.
answered Jan 10 '19 at 05:53 AM
Nebula Games Inc
Follow this question
Once you sign in you will be able to subscribe for any updates here