Playing and Killing Sounds

Hey Everyone

Just a question regarding playing sounds.

  1. If in an Actor BP I use ‘Play Sound at Location’ when I interact with it for example, and the sound is not a Looping sound, do I need to destroy it if I’ve set a reference to it? Or once it has finished playing, it will be destroyed automatically?

  2. If I fade out a Looping sound to 0, and i’ve set a reference to it, Do I need to destroy it after it’s faded, or is this handled automatically?

  3. If I need to destroy sounds after they have been played, what is the best/right way of doing this?

Thanks.

Great questions. I would also like to learn this. Subbed!

And 1 more question:

Like the 1st question, if I have a sound in a BP Actor which plays whenever i interact or whatever, and is not looping, what happens if I destroy the actor? Is the sound still referenced in memory, do I need to do anything with it? Or because the Actor is destroyed, the reference in it for the sound is also destroyed and I don’t need to do anything?

@Jimminy_Cricket

  1. If in an Actor BP I use ‘Play Sound at Location’ when I interact with it for example, and the sound is not a Looping sound, do I need to destroy it if I’ve set a reference to it? Or once it has finished playing, it will be destroyed automatically?

’Play sound at location’ does not have an output pin so you can’t store and kill the sound anyway. ‘Spawn sound at location / attached’ will give you a pin and you can kill it, but why bother if it’s only a couple of seconds. If it’s looping / long then yes, you need to kill it.

  1. If I fade out a Looping sound to 0, and i’ve set a reference to it, Do I need to destroy it after it’s faded, or is this handled automatically?

If you have spawned a sound, setting the output to zero does not kill the sound, it just stops it playing. You still have to kill it / stop it.

  1. If I need to destroy sounds after they have been played, what is the best/right way of doing this?

Destroy Component.

Like the 1st question, if I have a sound in a BP Actor which plays whenever i interact or whatever, and is not looping, what happens if I destroy the actor? Is the sound still referenced in memory, do I need to do anything with it? Or because the Actor is destroyed, the reference in it for the sound is also destroyed and I don’t need to do anything?

**If you destroy the BP, everything with it will get killed also, it just may not happen when you want it to. If the timing is tight, you have to control the clean up yourself. **

2 Likes

Thanks so much for the answers. Yeah I meant Spawn Sound at Location in the first question, my bad. Now I know exactly how I should be handling sounds.
Thanks again.

Thanks for the tips clockwork.