Thanks, that's a nice tip! I'll probably implement that just so I don't forget it. The only issue might be if I want to specifically fade in and out the music track only without affecting the volume of SFX.
Actually, the game.Audio.Volume Attribute only affects the bg music. SFX are controlled separately.
I keep two global game attributes, musicVolume and sfxVolume. I fade those in and out. The music and sound volumes are set to those attributes' values.
Comments
You have access to the global Volume Attribute.
Control that with a Rule and a Timer, like this:
Fade Out:
Rule
When game.Volume > 0
Timer
Every 0.01
Change Attribute game.Volume to game.Volume - 0.01
------
Fade In:
Rule
When game.Volume < 1
Timer
Every 0.01
Change Attribute game.Volume to game.Volume + 0.01
I keep two global game attributes, musicVolume and sfxVolume. I fade those in and out. The music and sound volumes are set to those attributes' values.
The attributes sound like a good way to go and I'll follow suit.