Not able to raycast on image
I am trying to provide user menu which includes three options. I have added images to canvas element for displaying option. I will need user to look at the option and tap gesture to select it. But somehow i am not able to hit the raycast at these images. Giving below screenshots and code snapshots. I am using Unity 5.4.0f1-HTP
can you share the Blocking $$anonymous$$ask and Blocking Objects options of the graphic raycaster?
Thanks for looking into this. Blocking Objects: None, Two D, Three D, All (Can select only one of them)
Blocking $$anonymous$$ask: Nothing, Everything, Default, TransparentFx, Ignore Raycast, Water, UI ($$anonymous$$ulti Selectable)
Answer by LK84 · Aug 12, 2016 at 07:48 AM
Would be nice to get a look at your code, but maybe my code can help you out which I wrote for a similar problem, Just a little bit different approach achieving basically the same:
void TapInput (Touch tap,GameObject go)
{
PointerEventData pointer = new PointerEventData(EventSystem.current);
pointer.position = tap.position;
List<RaycastResult> hitObjects = new List<RaycastResult>();
//do a raycast based on the position of the tap
EventSystem.current.RaycastAll(pointer, hitObjects);
//Check if tap lands on Game Object
if (hitObjects.Exists(x=>x.gameObject==go))
{
//Do Your stuff
}
}