Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: ddfire on November 19, 2012, 05:07:35 PM
-
hi
NGUITools.Playsound(...) has a bug... if you disable the first audiolistener, and active a second one, since mListener is static will not detect the change and will trow:
Can not play a disabled audio source
UnityEngine.AudioSource:PlayOneShot(AudioClip, Single)
NGUITools:PlaySound(AudioClip, Single, Single) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:100)
UIButtonSound:OnClick() (at Assets/NGUI/Scripts/Interaction/UIButtonSound.cs:49)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:546)
UICamera:ProcessTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:1014)
UICamera:ProcessMouse() (at Assets/NGUI/Scripts/UI/UICamera.cs:796)
UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:654)
to reproduce play a sound, disable the audio listener, enable other one, try to play a sound again.
-
More than one audio listener in the scene is an error that Unity will happily inform you about.
Just don't do it. If you want to have an audio listener move from one camera to another, make it separate. Don't attach it to your camera. Simply always make it set its position to the current camera in LateUpdate.
-
cool, thanks!