Unity mouse input not working in webplayer build
- by Califer
I have a button script with the following code
void OnMouseDown()
{
animation.Play("button-squish");
enlarged = true;
audio.PlayOneShot(buttonSound);
}
void OnMouseUpAsButton()
{
if (enlarged)
{
SelectThisButton();
enlarged = false;
animation.Play("button-return");
}
}
void OnMouseExit()
{
if (enlarged)
{
enlarged = false;
animation.Play("button-return");
}
}
It works great in the editor, but when I made a build and tested it in Chrome none of the buttons had any response. Further testing revealed that it did work in Firefox. Rather than telling people to change their browser if they want to play, I want to make the button code work. How else can I get the buttons to know when they're being pressed if the built-in stuff isn't working?