Welcome,
Guest
. Please
login
or
register
.
December 11, 2024, 11:07:31 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Volume Slider
« previous
next »
Print
Pages: [
1
]
Author
Topic: Volume Slider (Read 1473 times)
neccta
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 1
Volume Slider
«
on:
December 13, 2014, 05:39:03 AM »
I setup 3 volume sliders that work just fine. However if you were to move the volume slider for 'music' it would still effect the volume for 'sound'. I have two child gameobjects under MainCamera one for music the other sound, each one with a audio source.
void
Start
(
)
{
UISlider slider
=
GetComponent
<
UISlider
>
(
)
;
EventDelegate
.
Add
(
slider
.
onChange
, masterVol
)
;
EventDelegate
.
Add
(
slider
.
onChange
, soundVol
)
;
EventDelegate
.
Add
(
slider
.
onChange
, musicVol
)
;
}
// Update is called once per frame
void
Update
(
)
{
}
void
masterVol
(
)
{
GameObject
.
Find
(
"Sound"
)
.
audio
.
volume
=
+
UISlider
.
current
.
value
;
GameObject
.
Find
(
"Music"
)
.
audio
.
volume
=
+
UISlider
.
current
.
value
;
//Debug.Log("Sound volume: " + UISlider.current.value);
}
void
soundVol
(
)
{
GameObject
.
Find
(
"Sound"
)
.
audio
.
volume
=
+
UISlider
.
current
.
value
;
}
void
musicVol
(
)
{
GameObject
.
Find
(
"Music"
)
.
audio
.
volume
=
+
UISlider
.
current
.
value
;
}
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Volume Slider
«
Reply #1 on:
December 15, 2014, 12:39:30 PM »
Of course it does. You are registering all 3 listeners to the same slider in your Start() function.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Volume Slider