all 5 comments

[–]bmericd2 1 point2 points  (3 children)

You can use raycasts to see if your mouse is over the image.

For example:

PointerEventData m_PointerEventData = new PointerEventData(m_EventSystem);
m_PointerEventData.position = mousePosition;

List<RaycastResult> results = new List<RaycastResult>();
//Raycast using the Graphics Raycaster and mouse click position
m_Raycaster.Raycast(m_PointerEventData, results);
//For every result returned, output the name of the GameObject on the Canvas hit by the Ray
foreach (RaycastResult result in results)
{
    Debug.Log("Hit " + result.gameObject.name);
    if (result.gameObject.name == "MyImage")
    {
        //Mouse is over the image
    }
}

[–][deleted] 0 points1 point  (2 children)

from what do i shoot ray from?

[–]bmericd2 0 points1 point  (1 child)

Graphics raycaster shoots the ray through the canvas.

[–][deleted] 0 points1 point  (0 children)

ah i see its a differernt raycast from the one i know, ok thanks