I’m currently coding the main menu for the game I’m working on. I’ve coded it so that when the mouse is on top of certain text, it will turn red and a sound will be heard. I’m trying to add another sound that will play when I actually click the text. I am a beginner coder so I apologize if the answer is very simple. I have researched this, but I am still having difficulties.
//this plays the sound when the mouse hovers over the text.
function OnMouseEnter() {
audio.Play();
}
//this is the part where I’m having trouble with. I have a sound called click and I made
it an AudioSource to all the text that can be selected.
var AudioSource = “Click”;
function OnMouseDown() {
audio.PlayOneShot(Click,1);
}