Hey guys. So, I'm trying to "roll my own" gui for a simple app. Since this app will ultimately make its way to the iPhone I want to avoid using the 'GUI.' stuff since, as I understand it, this method is somewhat of a resource hog on the iPhone. What I am trying to do is simply make a set up where I can create a Rect that is accurately placed over my GUITexture at all times (adjusting for different window sizes as well). Apparently there is a difference in the way the GUITexture coordinates are figured versus the way the Rect position is figured. Are there any solutions to making sure that I can have, say, a 64x64 GUITexture stay within a 64x64 Rect at any window size?
Unfortunately, just doing this: Code (csharp): Rect guiRectTest = myGuiTexture.GetScreenRect(); GUI.Box (guiRectTest, "Test"); results in a rectangle drawn on the opposite end of the screen from the texture it's supposed to appear over.
OnGUI uses top-down coords; screen rects are normally bottom-up. Realmaze3D uses GetScreenRect with no issues. --Eric
Yep, OnGUI and apparently also mousePosition uses top-down coords. Not sure why screen rects use something different. Is there anyway to convert between the two positions to reposition one element or another (in script) so they always match up?
Flip the y element based on screen height (i.e., var flippedY = Screen.height - Input.mousePosition.y). Only OnGUI (and associated events like Event.mousePosition) is top-down; Input.mousePosition etc. are all bottom-up. --Eric