Author Topic: Why GUI sounds can't be heared?  (Read 2440 times)

primus88

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 50
    • View Profile
Why GUI sounds can't be heared?
« on: December 29, 2013, 07:17:12 AM »
Hi guys,

I have a listener on the main camera in my game.
Also, I made sure to deactivate the listener on NGUI camera.

The problem is that there are no GUI sounds playing.

I have about the same setup in another scene and works. The difference is that, in the first scene the camera is not from the beginning in the scene but it is spawned after about 1 second.
Could that be the reason? Is NGUI like checking for the audio listener in the beginning, he doesn't find it (because it is not yet spawned) and does not reproduce anymore GUI sounds?

If this is indeed the problem, how can I get around it? Because I must have the listener spawn after 1s.. can't do it sooner due to different constraints.

Thanks
« Last Edit: December 29, 2013, 11:34:37 AM by primus88 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Why GUI sounds can't be heared?
« Reply #1 on: December 29, 2013, 06:32:09 PM »
Have a look inside NGUITools.PlaySound. It does cache the listener, but it finds a new one if the existing listener is disabled. It looks for the listener on the main camera. If no main camera is present, it looks for any camera. Once a camera is found, if it has no listener, NGUI adds one.