Question by 
               ReinholdtheR · Sep 15, 2015 at 04:49 PM · 
                c#guiguitexturerectcontains  
              
 
              Rect.Contains not working correctly
That's my code:
 void OnGUI (){
         if (GUI.Button(Rect1, "Rect1")){
             Debug.Log("Clicked the button with an image");
         }
     }
 
     void Update () {
         Rect1 = new Rect (
             button1.GetComponent<RectTransform>().position.x - (0.5f * button1.GetComponent<RectTransform>().localScale.x * 100f),
             Screen.height - button1.GetComponent<RectTransform>().position.y - (0.5f * button1.GetComponent<RectTransform>().localScale.y * 100f),
             button1.GetComponent<RectTransform>().localScale.x * 100f,
             button1.GetComponent<RectTransform>().localScale.y * 100f);
         
         if (Rect1.Contains (Input.mousePosition)) {
             Press1 = true;
             print ("inside");
 }
 }
Although my mouse is over the guibutton it's not detected and nothing is printed :( Please help me
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                