Hi there,
I’ve got this script that I’ve modified from NGUI (UIButtonSound.cs) (I am in noway a coder) and I’m trying to disable all audio when a NGUI button is clicked.
I’ve used a the same script below, except I’ve used it for an audio source to disable music on a different NGUI button and that works.
Can someone please explain why the script below disables the audio listener but not re-enabled it.
using UnityEngine;
using System.Collections;
public class GameAudio : MonoBehaviour
{
public enum Trigger
{
OnClick
}
public Trigger trigger = Trigger.OnClick;
void OnClick ()
{
if (enabled && trigger == Trigger.OnClick)
{
AudioListener.volume = 0.0f;
}
else
{
AudioListener.volume = 1.0f;
}
}
}