Is OnMouseEnter fundamentally broken?

Hi Guys. Hopefully someone can help me with this.

I’ve been using OnMouseEnter a lot recently and originally found a bug that any keypress would retrigger the OnMouseEnter. This meant if the mouse was over an object that bounced when the mouse is positioned over it - pressing a key would retrigger the OnMouseEnter and bounce the object again.

This - I can live with… I’m only using the keyboard for debug stuff.

However! Last night I started work on some GUI for our prototype and using OnMouseEnter I bounce the GUITexture and let the element know it should wait for a mouse click.

This works fine in the editor. Everything functions as coded and as expected. However, when I exported to the web player nothing happens. No bounce and clicking does nothing because the OnMouseEnter is not triggering the GUI element doesn’t know that the mouse is over it.

I got a bad feeling I’m going to have to rip out all of these OnMouseEnter/Exits and make my own… or maybe just for the UI :frowning:

I’m pretty sure I can’t be the only person having these issues as my code is not that clever :slight_smile:

Any advice is much appreciated.

OnMouseEnter doesn’t get triggered a second time when I press a key. Do you mean you have code that uses the keys and as such is somehow triggering OnMouseEnter? If so, can we see the code?

The keyboard triggering the OnMouseEnter again isn’t really a big problem. The main problem is the OnMouseEnter on a GUITexture not triggering in the web player (but is triggering in the editor).

Okay - this is getting even weirder… I just loaded up my project to start work on it again and the OnMouseEnter wasn’t working IN EDITOR!

So I created a new scene and tested the code in isolation and it was fine. Loaded my scene again and it was working.

Any Unity tech people who read this want to let me know if this is a known bug?

I’ll dig for another hour then I think it’s time to rip OnMouse out of my project and write my own…

There are a couple of reported bugs similar to this. Is there an OnGUI function in the script with the OnMouseEnter? If so, does the problem stop when you comment out the OnGUI function (fully, not just the function body)?

I just went extreme and commented out ALL OnGuis in the project. Still the same problem. Works in the editor - doesn’t work in the build.

Any chance this is fixed in V3?

It wouldn’t hurt to remind the QA team with an extra bug report, just in case :wink:

Just submitted a bug report. I think I’ll move on with other things and come back to this when I get V3 or the Beta.

Cheers!!