Search Unity

How to handle button OnClick event along with Input.GetMouseButton(0)

Discussion in 'UGUI & TextMesh Pro' started by angel1st, Feb 5, 2020.

  1. angel1st

    angel1st

    Joined:
    Nov 16, 2019
    Posts:
    35
    Hi there,
    I would appreciate your help/hints on the following matter:
    I have a panel at the bottom of the screen with a couple of buttons. On the other hand, since this is a mobile game, I basically process Input.GetMouseButton(0) in my player FixedUpdate method.
    The issue I have - when I click on a button, the click is also propagated by player FixedUpdate method, which is undesirable.
    So my question is - how can I process OnClick only and stop propagating the event to Input.GetMouseButton(0) when the user clicks over the button? Alternatively - if the implemented approach is not the right one, please suggest the better one to handle the case.
    Thanks!