What I mean is play it when the event, e.g: OnMouseEnter, occurs. Here’s my script.
using UnityEngine;
using System.Collections;
public class ButtonSFX: MonoBehaviour {
void OnMouseEnter()
{
GetComponent<AudioSource>().Play();
}
void OnMouseExit()
{
GetComponent<AudioSource>().Stop();
}
void OnMouseDown()
{
{
GetComponent<AudioSource>().Play();
Application.LoadLevel(1);
}
}
}
Also, is there anyway to play a DIFFERENT sound when OnMouseDown happens? Thanks!