I've followed your steps.
The current scene:
audio_music (Node2D)
- button (Button)
- music (AudioStreamPlayer2D)
The current GDScript codes attached to the node audio_music:
extends Node2D
func _ready():
$music.play()
func _on_button_pressed():
$music.stream_paused = !$music.stream_paused
But the result remains the same. Whenever I press the button of the music sprite, the music continues. Picture link: https://prnt.sc/sek2ta
Also my original idea for the mute button is this:
My scenes:
menu
CanvasLayer
- btn_play (TextureButton)
- btn_credits (TextureButton)
- btn_quit (TextureButton)
- btn_mute (TextureButton)
audio_player
Node
- ResourcePreloader
- AudioStreamPlayer
Is there a way for the "btn_mute" in scene menu can mute the music in the entire game background, while the "AudioStreamPlayer" is in scene audio_player?
If so, then what are the steps to do that? as well as the required scripts?