Works in editor but not on Device(Android)

Hi guys/girls,

maybe someone here can help me determine why this line of code works on editor but not on devices:

if (!EventSystem.current.IsPointerOverGameObject ())

So I have a player which is following the touch and I have a button in top of screen for which I want when pressed something happens, but player do not move to that position where is the button. This works in editor but is totally ignored on device. Help!

Maybe it is because both player and UI button are GameObjects?..Dont know!

Alen

Mobile devices don’t have a mouse so maybe the default parameterless version doesnt work.

If you are using single touch only - this might work;

    if (!EventSystem.current.IsPointerOverGameObject (Input.GetTouch(0).fingerid))

This will only check the first touch though, so no multtouch, There is probably a much better way.