#pragma strict
var isQuitButton = false;
var isInfoButton = false;
var sound1 : AudioClip;
function OnMouseEnter () {
renderer.material.color = Color.red;
}
function OnMouseExit () {
renderer.material.color = Color.white;
}
function OnMouseUp(){
if(isQuitButton){
Application.Quit();
audio.PlayOneShot(sound1);
}
else if(isInfoButton){
Application.LoadLevel(2);
audio.PlayOneShot(sound1);
}
else{
Application.LoadLevel(1);
audio.PlayOneShot(sound1);
}
}
When i click on the text it says; “MissingComponentException: There is no ‘AudioSource’ attached to the “Play_text” game object, but a script is trying to access it.
You probably need to add a AudioSource to the game object “Play_text”. Or your script needs to check if the component is attached before using it.” even though i have a .WAV file attached to it.