I have an issue with my raycast for pointer clicks.
I set up a layerMask so that it only applies to my character but it doesn’t seem to register.
This is what i have currently:
public void OnPointerClick(PointerEventData evd)
{
if(evd.button == PointerEventData.InputButton.Left)
{
if (Physics.Raycast(ray, out hit, layerMaskPlayer))
{
Debug.Log("Hit: "+hit.transform.gameObject);
}
else
{
Debug.Log("Miss");
}
}
}
For some reason this doesn’t work it selected the floor beneath him. This is my layer mask in the editor that i setup:
My player is assigned to this Character layer. With the above setup, my ray cast debug log gives “Hit: Floor”, that is the object he is standing on which is not what i wanted.
So then i tried with these settings:
Then i don’t hit anything at all, i get “Miss” for my debug log.
My player has a capsule collider attached too.
Please help as i am totally lost on what is wrong here.