How do I set a member variable value in GD script?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kayd

I’m using a specific audiobus for all of the events in my game that calculates the distance of the player to the event, and then plays back the sound at a designated noise level depending on the distance. I did this in order to create realistic sound design.

My only issues is is that I cannot set the value of float volume_db because it’s a member variable.

So, is there a way to get around this?

:bust_in_silhouette: Reply From: Ertain

You can access “volume_db” directly.

So if you have an audio bus audiobus, you would access it like this:

# AudioEffectAmplify object
audiobus.volume_db = 1.0