Search Unity

UI button ignoring touch input Android

Discussion in 'UGUI & TextMesh Pro' started by DevGamePlayGame, May 25, 2016.

  1. DevGamePlayGame

    DevGamePlayGame

    Joined:
    Dec 10, 2013
    Posts:
    5
    Hi.

    I am facing a very weird issue, where the button ignores input (around 60% of the time) only on Android device.

    This means the end user would have to press the button multiple times until it works which is undesired.

    When run in Unity editor or PC, it worked flawlessly.

    There are other scenes which has buttons, but they work 100% of the time. Only in this scene where the issue happens.

    I've tested on 2 Android device one being high end performance, other in low end.

    I initially thought may be it is to do with low frame rate (~15 - 20 fps Vodafone 875), but this issue persisted even on high end phone (60fps Sony Z5 Compact).

    Things I've checked:
    - Raycast target
    - Interactable
    - Graphic Raycaster
    - Canvas order in layer

    Desired behaviour upon touching button:
    - Fade out the screen
    - Play a selection sound (From Sfx manager)
    - Deactivate the current canvas
    - Enable other canvas.
    - Fade in once fade out is complete
    - Read out the book title (From voice manager)

    Current behaviour upon touching button:
    ~60% of the time, no action. No sound played. No screen transition.
    ~40% of the time, works perfectly.

    Current Hierachy
    Book shelf (Screen overlay canvas)
    - Mask (Also has scroll rect which scrolls parent)
    - Parent (Parent of all books)
    - Books (Buttons that arn't working at the moment)

    Device tested: Sony Z5 Compact (High end) , Vodafone 875 (Low end)
    Unity version tested on: 5.3.4f1, 5.3.5f1


    Please let me know if there are any more information that is required.
    I've attached a screen shot of profiler (using low end phone), Screen shot of the phones (both low end and high end)
     

    Attached Files:

    Last edited: May 25, 2016
  2. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Just a wild guess but maybe some invisible object is covering the screen ? maybe you ave a scroll view with a transparent background that you scroll up and down and only when its scrolled all the way to the top its possible to click the buttons ?

    I have had similar issues in the past where it wasnt actually a bug in my code or in the Unity UI system but rather an issues caursed by a transparent object going ontop of the clickables.

    Cheers
     
  3. DevGamePlayGame

    DevGamePlayGame

    Joined:
    Dec 10, 2013
    Posts:
    5
    Thanks for the reply!

    If there was any transparent objects, shouldn't the PC and Editor version not work as well? oO

    I will have a closer look if there are any transparent objects.
     
  4. DevGamePlayGame

    DevGamePlayGame

    Joined:
    Dec 10, 2013
    Posts:
    5
    Just solved this issue.

    For those who were having similar problem, the issues was the scroll rect being too sensitive.

    most of the touch was triggering "OnDrag" instead of "OnClick" which was why the button was getting ignored.

    I fixed it by increasing the "Drag Threshold" in EventSystem.
     
    MarcusRLA and theolagendijk like this.
  5. MarcusRLA

    MarcusRLA

    Joined:
    Jun 5, 2015
    Posts:
    2

    Thanks for posting this, I've been dealing with the same issue.
     
  6. Jure-Veler

    Jure-Veler

    Joined:
    Mar 31, 2015
    Posts:
    2
    Solved my problem as well. great information!
     
  7. MarkHelsinki

    MarkHelsinki

    Joined:
    Jul 14, 2021
    Posts:
    23
    Thank you SO MUCH.
     
  8. adnanhussain786112

    adnanhussain786112

    Joined:
    Aug 30, 2021
    Posts:
    3
    Anyone still Looking for solution then you should go to the properties of event system of canvas in play mode and check where the raycasts are going , I mean you can see which object is blocking your clicks in play mode and uncheck the undesired raycast targets Note: unity always keep the raycast targets of all ui elemnts on even the texts so you disable them if not required.

    cheers!
     
  9. adnanhussain786112

    adnanhussain786112

    Joined:
    Aug 30, 2021
    Posts:
    3
    Thankks for the solution bro