The music gets played when I press “1”. But not when its called from the UI. I have also tried doing it via a replicated variable update function. But that gives the same result.
I just don’t get why this doesn’t work. First of, why can you not put the code in image 2 in the UI? Because when its played, it can be treated like a sound 2D. And secondly, why is it different if I call the same event from my actor vs my UI? This should be the same.
I think its a bug. But if someone has a solution, please let me know. Because this has been really frustrating. Thank you!
I already checked that. They all return true. And it is playing. The issue is that the MediaSoundComponent doesn’t work. Even if its added to my actor.
first , you need to refrenc it by get all actors of a class(index 0)(if that is the only one!) and refrence the media sound component in play music function of UI bplueprint.
Hello again. Sorry for the wait. I had to move my project to Unreal 5.7.4. I have tested it. And it doesn’t work. And my actor does indeed only exist once in the world.
The actor has to be in the levels. Weather drag and drop in levels, or spawn, or put the code in player character or in a blank actor you put in a level or whatever, but the actor has to be in the level. And you need to use get all actors of a class (get 0) to reference it or use some other technique.
Yes. They are in the level. And I used get all actors of class. The code is identical. The only difference is that I trigger the event from the UI instead of the actor.
Sometimes if you check this on event begin (in UI widget) the actor may not be loaded in the level, so it doesn’t fetch the reference to that actor. Check for errors and warning in the log.
I have no errors in the log. And the event does fire. All checks return true. But I just don’t hear anything. So I think that the MediaSoundComponent doesn’t work for some reason even though everything is identical.
I finally solved it. You need to add the MediaSoundComponent at runtime for some reason. But now it works. I can now play my .WAV file from a UI. Although the old code should have worked as well. So I still think its a bug.