Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to deal with UI sticky hover effect on touch screens ?

Discussion in 'UGUI & TextMesh Pro' started by Avalion, Nov 25, 2016.

  1. Avalion

    Avalion

    Joined:
    May 2, 2012
    Posts:
    34
    Hello all !
    I'm wondering if someone found a way to deal with the sticky hover effects over the UI elements.

    I have a scene with toggles. Whenever a toggle is hovered at the end of a drag and drop touch, its state switches to "hover" and stay in this state despite of there is no touch on the screen. This effect is pretty annoying in our game as the "hover" effect is really similar to the "selected" one.

    Another annoying issue is clicking on a UI item is pretty hard as Unity consider too fast the touch as a drag and drop action, that will not call the onClick function of a Button or the onValueChanged of a Toggle.

    I already tested things as "EventSystem.current.SetCurrentSelectedGameObject(null)" but it did not work and my toggles already have "Navigation" set to "None".

    Any help or advice would be really appreciated.

    Is there any way to edit this behavior, in order to clean the app mouse hover when there is no touch on screen on a mobile device ?

    Thanks in advance.
     
  2. JoaoPaul54

    JoaoPaul54

    Joined:
    Nov 20, 2013
    Posts:
    52
    This is a behavior that usually only happens due to navigation being turned on. are you sure you disabled it in all the buttons?

    I believe you can also change the toggle state explicitly by changing the properties of it but it should not be needed.
     
  3. Avalion

    Avalion

    Joined:
    May 2, 2012
    Posts:
    34
    Thanks for the reply.

    All toggles are set to None for Navigation. As they are instantiated from a prefab, i'm sure they are all to this value.

    I need a useful item that manages this without having to add it on my Toggles, because my project is cross platform and I want to keep this behavior for Standalone (even if it is nonsense to have "no touch" in standalone). I already tried to deselect the currentSelectedGameObject (non-InputFields) Selectable when the Input is released but it didn't work.

    Whenever I use Unity Remote on my iPad, the hovered elements are restored to their normal state at the end of the drag & drop only if my mouse is on Game View. If the mouse is somewhere else, this effect reproduces. I now have a fast test environment to try some things.

    I'll continue my searches and tests.
     
  4. JoaoPaul54

    JoaoPaul54

    Joined:
    Nov 20, 2013
    Posts:
    52
    Any chance you upload that fast test environment so other people can help?
     
  5. Avalion

    Avalion

    Joined:
    May 2, 2012
    Posts:
    34
    I can't upload my project but I made an empty one where you can reproduce this effect.

    http://www.mediafire.com/file/9icq992cetth21a/StickyHoverProject.zip

    Here is the test process :

    1. Download and Open the Unity Project (Unity 5.3.4 or 5.3.6)
    2. Connect your iPad and launch Unity Remote app
    3. Add your iPad in Edit/ProjectSettigns/Editor/Devices
    4. Run. You must see a list of 6 toggles.
    5. This won't reproduce if the mouse is on the Game view so click anywhere else. (Note : when the Game View is selected, this is the behaviour I'm searching for)
    6. On the iPad, start a drag and drop anywhere and finish it over one of the not selected toggle
    7. Release the touch. The toggle will continue to display in orange.

    This can be reproduced once builded on any mobile device.
    We're experiencing this behaviour in Android too.

    I don't want this effect as the selection of a toggle is orange too.

    I submitted a Bug report with this message : (Case 855977)