title: Unity Raycast UI button and call its on click event
body: <p>Is there way to call the onclick event from a raycast?
  I have world scale canvas attached to an object that has images with buttons. 
  When I select the button with the mouse my event function is called.
  But now I am trying to adjust the code so I can avoid using mouse all together.</p>
  
  <pre class="lang-cs prettyprint-override"><code>[SerializeField]
  private Image cursor;
  [SerializeField]
  private LayerMask uI;
  
  if (Input.GetButtonDown("Fire1"))
      {
          Ray ray = Camera.main.ScreenPointToRay(cursor.transform.position);
          RaycastHit hit;
          if (Physics.Raycast(ray, out hit, 100,uI))
          {
              Debug.Log(hit.collider); 
          }
      }      
  </code></pre>
  
  <p>This is the code I use to raycast into the world space canvas which works and returns the images but I am not sure how I can now call the onclick event since I am not using the mouse but a image instead</p>
  
  <p>Is there way to call the onclick event attached to image that I raycast to or do I have to redo my entire script and not use on click events?</p>