- Home /
Main window mouse event
Hi, is there a way to catch the OnMouseExit and click event of the main standalone game window? I need to catch mouse events e.g. a clink'n'drag that ends outside of the main window.
thx
Answer by Prodigga · May 27, 2013 at 10:36 AM
You can check the mouse position to see if the mouse X/Y is negative, or if X/Y is larger than screen width/height. This will tell you if the mouse is outside of the screen :)
edit: It looks like it is currently not possible to get a window ID and pass drag/drop information outside of the unity window. It has been on the 'wish list' for a while now. You may be able to find something here
it seems that Unity does not forward Event outside of the main window. I just want to use your approach to test if the coords are outside but it does not seem to be a feasible way...
Answer by sfaragnaus · May 27, 2013 at 03:53 PM
right, but is it possible to obtain the main window id in order to use OnMouseExit callback?
for anyone interested, I've found that Event.current.rawType contains all events, even the ones triggered outside the current window, as per this post:
http://forum.unity3d.com/threads/172696-What-s-the-difference-between-Event-rawType-and-Event-type