#Help with Sound and Music Volume

1 messages · Page 1 of 1 (latest)

gray parcel
#

Hi, I'm running into an issue with my music volume bar and sound volume bar. Whenever I turn the music volume down, it automatically affects the sound volume. Here are the graphs for both of them. Does anyone have a solution in mind?

twin cipher
#

because MUSIC is using "audio LISTENER"

#

while sound is using set audio SOURCE

#

so maybe this wasnt intended. double check.

listener - only 1 per scene.

source, can have many.

#

does that help?

gray parcel
#

I tried using source for music but it ended up causing an error

gray parcel
#

I used this method for the music bar

twin cipher
gray parcel
#

I actually think I found a solution. Sorry for wasting your time

twin cipher
#

Helping others with uVS is not time wasted 🙂

#

Here's a video on how I did the sound + music manager with saved variable

#

you can use slider or whatever you want, the idea is setting an audio source component to each sound/music manager gameObject and there's that

gray parcel
#

Thanks a million!

#

Could you show me the group above plus sound?

twin cipher
gray parcel
#

The same logic can be applied to the music manager, right?

twin cipher
#

yeah

#

they are actually twins - just different variable names in another gameObject

#

just in case the blocks doesn't make sense, here's how it looks separated. This is the part that manages the mechanics, the rest are for UI purposes

(multiplying x10... so 0.1 in inspector shows in volume text UI as 1.
and max 1 becomes 10. Can use x100 if you want max volume to be 100 as 100%)

gray parcel
#

I can just replace the UI purpose nodes with the slider right?

twin cipher
#

yeah

#

the slider just gives you a value, so you use that value for your variables

#

should be the same: from 0 to 1. left to right.

gray parcel
#

Gotcha

#

Would something like this work, or am I gonna need the calculations as well?

twin cipher
#

cant say without knowing how your UI looks like (both visually / editor)

#

but test it !

gray parcel
#

So it works but it's only affecting the music on the next scene and not immediately on the start/settings scene. I want to have the bar scale the volume immediately when the slider is adjusted

#

This is what I did

twin cipher
# gray parcel

it's because you are saving the slider, and not GET the slider value before setting the volume

#

so when you move the slider, it does nothing.

#

in my case, the custom events "PlusMusic" and "MinusMusic" (the ones that starts these flows)... triggers when i click these button

#

i dont know about sliders, but when you move them - an event should trigger so you recognize when it has changed and get that value into teh settings variables you have

#

another way (less performant) is to use onUpdate and check it's value on real time. so when slider changes, without events, it will get the current value on the slider and save settings.

as you can see - this is not good because most of the times you are not changing volumes 😛

#

so find a way, so that when you move the slider, immediately an "event" get's triggered.

and then, you get these events to start your flows.

#

in short, you got the events inversed.
slider set value shouldn't be at the end of the flow.
when sliders move - this initiates the new values on the variables.