Make Sound Play as I Press Button

Is there a node or function to play a sound as the mouse button is held down on a button to trigger it, where it will stop playing as soon as the mouse button is released, but will resume the sound where it left off when it is pressed again?

You could do something like this:

1 Like

That works a lot better than I would have done it! I was going to segment a song into tiny portions and then make a sound cue with a concatenator that would just run through the list as the button is pressed, which would have been a pain. Thank you for this infinitely better method!

1 Like

Hello @Impudent_Swine ,
I’m leaving you another alternative that could work for you
First, you create an IA_InteractSound and add it to the IMC you are using, so you can assign it to an interaction key.

Then, you create a Blueprint for the button and add the sound using an Audio Component. In that Blueprint, you implement the logic needed to determine the audio’s duration.

After that, you disable Auto Activate on the Audio Component.


If you want the audio to repeat, open the sound asset and enable Looping.

Finally, in your BP_Character, you perform a Line Trace to define an interaction distance. This distance is handled using the Get Forward Vector multiplied by a float value (in this case, 100).

If the Hit Actor from the Line Trace is the previously created BP_Sound, the sound will play. When the input is released, the last playback time is saved, and when interacting again, the audio continues playing from that point.



(quick note ,the Print String is only for testing, you can delete it)

Hope it helps!

1 Like