why is screen inverted (mousepos, GUI el) any fixes?

ok why is it inverted?

when I’m placing GUI elements top left is X0 Y0

when moving with my mouse position bottom left is X0 Y0

it gives me loads of headache I can go with either one preferable top left but

for doing correct stuff sometimes in code I have to

YPos = -10-IYPos-(ItemCount*20)+((Input.Mouseposition.y - Screen.height) * -1); // it's for moving buttons around GUI

and sometimes not I’d prefer that’s always same

I was trying with project settings inputs but no invert seems to fix it

example:

	void OnGUI() {
		Vector2 gPos = new Vector2(10, 20);
		GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height));
		Vector2 convertedGUIPos = GUIUtility.GUIToScreenPoint(gPos);
		
		Debug.Log("GUI: " + gPos + " Screen: " + convertedGUIPos);
		GUI.Label(new Rect(0,0,100,20),Input.mousePosition.x.ToString());
		GUI.Label(new Rect(0,20,100,20),Input.mousePosition.y.ToString());
		GUI.EndGroup();
	}

labels are at top left while saying that 0,0 is bottom left

even if this page says it does it reverseGUIUtility.GUIToScreenPoint

also it doesn’t matter for

Vector2 gPos = new Vector2(10, 20);

where it is before or after begin group

The screen is not inverted. There are two pixel coordinate systems: screen coordinates and GUI coordinates. Screen is bottom-up, GUI is top-down. Do not use functions that return screen coordinates if you’re working with GUI coordinates–Input.mousePosition is for screen coordinates, so in OnGUI use Event.current.mousePosition instead, since that uses GUI coordinates.

This is just a thing you have to deal with (or you can wrap one of the classes in your own automatic inverter; a mouse-position or Rect inverter wouldn’t be too hard).

It’s annoying, it’s stupid, and it’s easy to fix, but it will never be fixed in any language you ever work in unless you do (or find) the fix yourself.

Pixels are arranged from top-left to bottom-right because monitors work by drawing from the topleft to the bottomright, and programmers just went along with that. I like that idea.

I’m not sure who decided it or why, but at some point someone said 'Wait, the [whatever] coordinate system starts at the bottom left! We need to do that!" That was a silly idea.

And then they-everyone proceeded to continue using top-left based coordinates for pixels, while using bottom-left based coordinates for other things (like mouse position).