I just realized this:
Get a square texture. Any size smaller than the screen (e.g. 32x32).
Use Graphics.DrawTexture(Rect(30,300,32,32), texture) or GUI.DrawTexture(Rect(30,300,32,32), texture) to draw the texture to the screen.
Next do this check:
if(Rect(30,300,32,32).Contains(Event.current.mousePosition) {
//some effect that will be noticeable when compiled.
}
Run within unity. Verify that the effect only occurs when the mouse is within your drawn texture.
Compile, run in a browser, verify that it still works. Enable full-screen.
Attempt verification.
Note that the detected rectangle does not line up with the texture.
I’ve attached a demo project that will demonstrate this behavior. Inside the /bin folder is a compiled webplayer. Run it and verify that the GUI.Box only displays when the mouse is inside the green square. Activate full screen and verify that that is no longer true (despite using the same rect for drawing and detection).
Edit:
This seems to be inconsistent from machine to machine although if it occurs on one machine, it will always occur on that machine. For instance, the machine I do unity work on has this issue, but my other work computer (an HP Touchsmart) does not. On my coworker’s macbook, the detection rectangle is shifted by about 2 pixels (compared to the unity machine’s down 20).
Curious.
695949–25060–$ScreenCoordinates.zip (241 KB)