Is there a way to have a universal mouse click sound?

So I’m working on adding sounds to my game and need one specific sound to play any time I left click my mouse. It needs to play wether the game is paused or not, and in every one of my levels. Really not sure how to do this, yet it’s super important.

Any help is greatly appreciated, thanks!

User Input event are only accessible from the you player controller and you player’s blueprint.

There is an event called On Mouse Left Click that you can call in these blueprints, and you can make these event Play 2D Sound.

Just remember to put this code in you player controller or your player’s blueprint as it will not work somewhere else.

Since all of you maps have a character in them it would be the perfect place to add this code.

I hope this helps :slight_smile:

Thanks for your reply, Night Watcher,

Do you happen to have any screenshots of how this should be set up? I tried all last night and all I accomplished was getting it to play sound when the game was un-paused, and if I clicked on a actor that already had some type of mouse input event enabled.

Thanks!

Hey, I just tried to create a similar system, I found out that you need to select the event node “Left Mouse Button”, and go to it’s details panel, you will find a checkbox for “Execute When Paused”

Did you place the play sound function in your character or player controller?

Try to place it in your player controller, just create a player controller blueprint and assign it in your gamemode

Great, that fixed the not playing on pause issue! One other thing I’m finding is it doesn’t play the sound when I click buttons from my widget BP’s. Do you know of anything that might solve that?

1 Like

Character.

Just tried it, same problem. Doesn’t play the sound when I interact with any widget components. Weird.

Thanks for the link! I will look into that a bit more later, but I just found another problem that this time, I really cant wrap my head around. So I have a different game mode for each level, and a different character BP for each game mode. I assigned the player controller BP to my other game modes, yet it doesn’t do anything when I enter those other levels.

I guess a work around would be to place a on mouse click event play sound in your widget too. here’s a thread on how to do it: