Skip to content

Setting the volume on an AudioInstance instead of PlayAudioCommand doesn't set it relative to a channel. #110

@Selene-Amanita

Description

@Selene-Amanita

Follow up of #103 / #106

If you have an AudioChannel called my_audio_channel with volume 0.5 let's say.

The fix works if you do my_audio_channel.play(my_handle_audio_source).with_volume(0.2);, it would set the volume to 0.1, as expected.

But if you do:

    let my_handle_audio_instance = my_audio_channel.play(my_handle_audio_source).looped().paused().handle()
    ///...

/// Then in another system
fn other_system (
    mut audio_instances: ResMut<Assets<AudioInstance>>,
    //...
) {
    //... get my_handle_audio_instance somehow
    let sound = audio_instances.get_mut(my_handle_audio_instance).unwrap();
    sound.resume(AudioTween::default());
    sound.set_volume(0.2, AudioTween::default());
}

then the volume will be set to 0.2 instead, I think, I do basically that and when the volume of the channel is 0. I still hear the sound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions