Hi. I am very new to unity so please excuse any silly/stupid errors. I am trying to detect touch on an Image that has been added to a Panel under the Canvas. I have added a sphere collider to the image and in the update function have written the following:
if (Input.GetMouseButtonDown(“0”))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, outhit))
{
Debug.log(hit.transform.gameObject.tag);
}
}
The problem is, it never flow never gets to the debug log.Any idea what Im doing wrong?
I can’t make it a button as I have multiple images and I should be able to select multiple objects at one go. Like touch on one and then move my finger/mouse pointer over the others and select them as I move across them.