- Home /
GUI co-ordinates bug?
Using Rect(), I created a few placeholder in the scene.
var p1 = Rect(Screen.width * 0.40, 220, 100, 100);
var p2 = Rect(Screen.width * 0.20, Screen.height * 0.35, 100, 100);
var p3 = Rect(Screen.width * 0.60, Screen.height * 0.35, 100, 100);
var p4 = Rect(Screen.width * 0.40, 220, 100, 100);
When checking to see the location of the placeholder with GUI,
function OnGUI()
{
GUI.Box(p1,"point1");
GUI.Box(p2,"point2");
GUI.Box(p3,"point3");
GUI.Box(p4,"point4");
}
I realize that point 1 and point 4 are reversed. Is this intentional as by Unity? Such that the GUI co-ordinates start from top-left. I did a test for the variables and the co-ordinates start from bottom-left.
Answer by Eric5h5 · Dec 15, 2010 at 06:08 AM
Point 1 and point 4 are identical. There is no bug; GUI coordinates are top-down. I don't know what your test involved, but it must have been screen space rather than GUI space since screen space is bottom-up.
oops. i posted my co-ordinates wrongly. Oh, so it was build like that. I was still wondering whether I did something wrong with my codes. Lol
Your answer
Follow this Question
Related Questions
v4.6 UI Element's Positioning Incorrect 1 Answer
Sometimes I get a bug with GUI. Focus received another field. 0 Answers
Unity3D Editor GUI issues 1 Answer
android and ios - phantom UGUI Button click when loading new scene w/ finger already down 1 Answer
uGUI Image component not auto-generating mesh around sprite? 0 Answers