Hey guys Im brand new to scripting anything at all, made my first script earlier, its just to mute/unmute a collider with an audiosource. That works fine but I cant find a way to limit the distance it which it works. Heres the script as it is now. Id also like to be able to adjust the distance it works at in the inspector.
using UnityEngine;
using System.Collections;
public class muteaudioclick : MonoBehaviour
{
void OnMouseDown()
{
if(audio.mute == false)
{
audio.mute = true;
Debug.Log ("Sound Off");
}
else
{
audio.mute = false;
Debug.Log ("Sound On");
}
}
}