I need help to fix an audio problem (UserWidget)

I have a problem in my project.
I have reproduced the problem in a new blank project.

These are the project files:
UISoundProblem.zip (13.2 MB)

The problem is a sound can not be played in a UI (more or less)
It does works when the player is shooting itself (see this video).

When shooting to other player. The event work, the amimation work, but the sound does not work.

I don’t want to replicate the audio. I just want the player to be the only one that can hear it when he get any damage.

How to fix it?


In this path are the files:

I made these changes to the code:

In BP_FirstPersonCharacter i added this (A Take Damage Rep_Notify):

In BP_FirstPersonProjectile i added this (Apply Damage):

In BP_Weapon_Component i added this (Spawn Projectile On Server):

I created a new HUD class (MyHUD) with this code:

I created a new UserWidget class (UI_PlaySoundWhenTakeDamage) with this code:


Any help is welcome!!

Thank you so much!!

Can you try to set “AllowBackgroundAudio” to true in the editor settings?
It is disabled by default - and I think that is why you are not hearing any sound (because the second PIE window has no user focus and thus is in the background)

image
Let me know if this fixes it :+1:

1 Like

Hi @Featuriing

Unfortunately that didn’t solve the problem.

Thank you very much for your help.
Very appreciated :heart:

1 Like

You are right about the focus and the sound.
When the PIE window is not focused, the sound is not heard.
I just did a test on my original project.
However, the option “Level Editor/Miscellaneous/Allow Background Audio” does nothing…
it seems to be broken… Maybe it’s a bug.
I have version UE5.3.2
It would be nice if someone else could confirm this.
I have been on the verge of madness for two days looking for a solution to this.

Thank you so much @Featuriing !!

1 Like

I reported the bug… i hope they can fix it soon

Thank you so much for your help @Featuriing :heart:

1 Like

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