Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Button states misbehaving if pointer/touch moves

Discussion in 'UGUI & TextMesh Pro' started by LoTekK, Aug 25, 2014.

  1. LoTekK

    LoTekK

    Joined:
    Jul 19, 2010
    Posts:
    136
    I've noticed that the editor-exposed On click event (really, the underlying active state) appears to be misbehaving if the mouse/touch moves after clicking down.

    Specifically:
    Tap/click on a button, don't release. Note the visual state change. Then move your mouse/finger without releasing, but remaining over the button. Note the button has now changed state to normal (instead of remaining active). If you release now, the on click event doesn't get fired.

    Unless I'm missing something, this is rather unintuitive, as well as causes lots of missed clicks on a touch device. It also contradicts the documented behaviour of firing the on click if the button/touch is released on the same button pointer down was fired.

    For now I'm getting around this by adding an event listener and using OnPointerClick.
     
  2. LoTekK

    LoTekK

    Joined:
    Jul 19, 2010
    Posts:
    136
    Apologies, did a bit more testing to see if I could nail down any more details, and realised the issue appears to stem from the button being in a scrollview (currently the content is smaller than the scrollview, so it doesn't scroll, which is why I'd forgotten about that bit).

    That said, I wonder if there could be an alternate method of handling the pointer click event in the above case. There doesn't appear to be a threshold setting for the ScrollRect component; perhaps that could help in such cases?
     
  3. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Just ran into the same problem.
    Toggles and Buttons in my case. Slider and input fields seem to work just fine.

    When they're inside a scroll view the slightest movement of the cursor (touch input) while clicking(tapping) on them makes them go to Normal-mode. Wich makes it near impossible on mobile devices to land a hit on them, since the slightest finger move on the toggle/button then makes it not react at all.
     
  4. ProjectCryken

    ProjectCryken

    Joined:
    Jul 25, 2012
    Posts:
    41
    I have exactly the same problem. Any fixes?
     
  5. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    We will be fixing this.
     
    adhdchris, Fuzzy and LoTekK like this.
  6. xenotime

    xenotime

    Joined:
    Apr 27, 2010
    Posts:
    12
    I have the same problem as Fuzzy. (Unity 5.0.0f4).
    Nobody seems to revive the subject so I wonder if a correction has been made.
    Does anyone have a solution to fix this problem?

    Thank you in advance for your answers.
     
    Last edited: Mar 27, 2015