public AudioClip _AudioClip;
AudioSource m_AudioSource;
void Start () {
m_AudioSource= gameObject.AddComponent
m_AudioSource.clip = _AudioClip;
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (UICamera.currentObject.CompareTag("Hit"))
{
Debug.Log("Onclick");
m_AudioSource.Play();
}
}
}