Hi,
im trying to figure how i can click with mouse and when mouseclick hits Gameobject it does something
I have BoxCollider2d on target Gameobject, but i can’t get this working.
void Update ()
{
if (Input.GetMouseButtonDown(0))
{
RaycastHit2D hit = Physics2D.Raycast(cam.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
if (hit == humanButton.collider2D)
{
print ("hit");
}
}