Author Topic: NGUITools plays the sound even when AudioListener.volume is set to 0  (Read 6524 times)

AlexGav

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
All the buttons in my project have the UIButtonSound script on them and after the update to Unity 4.2 the sound is played even though the AudioListener volume is set to 0.
There is only one AudioListener in the scene.
I can add an extra flag to the if condition checking that the audio listener is not null and enabled for the audio listener volume inside the PlaySound method, but I would rather not change an NGUI script.
Does anyone else have a better solution?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUITools plays the sound even when AudioListener.volume is set to 0
« Reply #1 on: August 05, 2013, 08:02:10 AM »
NGUITools.soundVolume controls it (also UISoundVolume script)

AlexGav

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: NGUITools plays the sound even when AudioListener.volume is set to 0
« Reply #2 on: August 06, 2013, 03:11:24 AM »
Thanks for the tip, but that doesn't really work because the in-game music and other sounds are not controlled through NGUI, it's just the buttons.
Having to also control the NGUITools.soundVolume everywhere besides the AudioListener.volume is not exactly what I am looking for.
Do you have any idea what might cause the sound to be played when it should be muted?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUITools plays the sound even when AudioListener.volume is set to 0
« Reply #3 on: August 07, 2013, 05:54:23 AM »
What doesn't work? NGUI always plays its own sounods through NGUITools.PlaySound, which is affected by NGUITools.soundVolume. When you're adjusting your audio listener volume, also set NGUITools.soundVolume as well, and everything will be as you expect.

Dusty E-D

  • Guest
Re: NGUITools plays the sound even when AudioListener.volume is set to 0
« Reply #4 on: January 06, 2014, 01:12:42 PM »
Did this change in unity 4.3?  I have my project set up so that it sets the AudioListener volume to 0 but leaves the NGUITools.soundVolume setting at the settings slider value.  I'm pretty sure it was working but just noticed today that even though the volume values are all correct I don't hear any of the sounds getting played with NGUITools.PlaySound.  If I set the AudioListeners volume to 1 along with all my background sounds I do hear sounds getting played through NGUITools.PlaySound again.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUITools plays the sound even when AudioListener.volume is set to 0
« Reply #5 on: January 06, 2014, 05:22:03 PM »
I vaguely remember reading a similar thread ~1 month ago about this behaving differently in 4.3...