Unity mouse input not working in webplayer build
Posted
by
Califer
on Game Development
See other posts from Game Development
or by Califer
Published on 2014-07-19T00:23:36Z
Indexed on
2014/08/19
4:33 UTC
Read the original article
Hit count: 210
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?
© Game Development or respective owner