UI buttons sometimes does not detect touch
When I touch a button on my mobile device, sometimes the click function is called, sometimes it's not. When I click the button with a mouse on my PC, the click function is always called fine (the problem only exists with the touch).
The function is called through the EventTrigger:
EventTrigger trigger = GetComponent<EventTrigger>();
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = EventTriggerType.PointerClick;
entry.callback.AddListener((data) => { OnPointerClickDelegate((PointerEventData)data); });
trigger.triggers.Add(entry);
I have both Standalone Input and Touch Input modules enabled in Event System. I tried different solutions posted online and nothing worked for me.
Any idea?
Thanks!
I had a similar problem, and it turned out the text on my button was blocking the raycast.
So... On the text component under the button I unticked the raycast target option. This may not be your issue but it's worth checking.
Your answer
Follow this Question
Related Questions
UI buttons sometimes does not detect touch 1 Answer
Unity / Oculus - Touch object as trigger 0 Answers
How to detect a touch inside a GUI 0 Answers
Android touches pass through UI elements 6 Answers
Multiple Scroll Not Working 0 Answers