GUI label dimensions bug

Probably I am overworked but that bug that I’m having is very wierd.

I draw stuff in rectangles:

		void OnGUI ()
		{  	    
				GUI.Label (headlineRect, "HEADLINERECT", headlineStyle);  	
                GUI.Label (buttonRect, "BUTTONRECT", headlineStyle);
		}

		void Update ()
		{  
                if (buttonRect.Contains (Input.mousePosition) && Input.GetMouseButtonDown (0)) {		    
                        doStuff()...        
				}
		}

Seems legit to me. The Rectangles are created in Start(). Doesnt even matter because I can see the two labels in the game.

Now when I click the “BUTTONRECT” text in game nothing happens. But when I click the “HEADLINERECT” text, doStuff() happens.

I am using version 4.3.4 I tried to restart unity. When I change the buttonrect in update() to headlineRect it works like it should.

You shouldn’t use Input.mousePosition for OnGUI code, since it uses a different coordinate system. Or mix Update with OnGUI for that matter. Use Event.current.mousePosition (and EventType.MouseDown) put all the input code in OnGUI.

I solved this with an own RectContains function. the y axis is in two different directions.