[SOLVED] Muting Sound

Hi there!

I have a question about muting sound if its playing.

with:
this.entity.sound.slots[‘Soundbox’].mute = true;

i could mute the sound if the sound isnt playing at that time. But if its playing and if i try to mute the sound then, it still continues playing.

Thx!

Hi @Question2u!

Interesting! :upside_down_face:

Maybe you can use one of the methods below.

// pause all sounds
this.entity.sound.pause();
// pause a specific sound
this.entity.sound.pause('beep');
// get a slot and set its volume
this.entity.sound.slot('beep').volume = 0;

Hi @Albertos,

thanks for your inputs!

I thought it would be nice, if i mute the sound but it would theoretically continue playing in the background, so when you mute / unmute its not like you paused the replay, you just … muted it :slight_smile:

My alternative thoughts also was to set the volume down or just use stop and play, but i was wondering why the mute method doesnt work as expected.

Like i said it works, if the sound isnt playing and i press the mute btn the sound isnt playing (i just use the mute method, no stop or pause or anything else) - but if its playing it has no effect. So it kind of works… the half way :smiley:

As far as I know there is no mute method, so setting the volume down will be the closest you can get I guess.

2 Likes