How to stop all sounds from a different scene?

Hello.

At the end of my animation I would like to stop the music which started playing from a different scene.
How would you achieve that (killing all sounds of the app) ?
Is there a global sound system I could use to turn the volume to zero from a script in my last scene?

Oh ok… found it !

this.app.systems.sound.volume  = 0.0;
1 Like

Setting sound volume 0, may not stop the audio.

Try this one in a script of any entity,
where ‘audio’ is set to an entity that has a SOUND component and ‘BGM’ as a SLOT in it.

var Abc = pc.createScript('abc');
Abc.attributes.add('audio', {type: 'entity'});

if( condition_to_play_audio ) {
    this.audio.sound.play('BGM');
} else {
    this.audio.sound.stop('BGM');
}