On Click Event

Hello. I am trying to make an app for mobile phones in Unity. Today I was looking for a video about changing scenes in unity. The youtuber who make the video said we should use EventTrigger instead of OnClickEvent because it is also working for mobile phones. I have two questions:

  1. Is OnClickEvent working for switching scenes on mobile phones?
  2. Does OnClickEvent work for switching between panels on mobile phone?
    Thank you.

This is the video:

He said about EventTrigger at 7:05

Hi @whiteshark01

“1. Is OnClickEvent working for switching scenes on mobile phones?”

Make a build and try?
“2. Does OnClickEvent work for switching between panels on mobile phone?”

AFAIK uGUI button OnClick should work on mobile, even if it is called a “click”.

However, now that you asked, I googled about it, and seems like this thing you mention has been an issue, several discussions around the internet exists, like this one:

Seems like issue might be with finger detected to be moving, resulting in drag instead of tap/button press. One solution suggested is to make drag threshold in UI EventSystem less precise:

https://www.reddit.com/r/Unity3D/comments/a0i1km/how_to_make_ui_buttons_on_mobile_phone_more/
https://docs.unity3d.com/Manual/script-EventSystem.html

But in general, there is no need to use EventTrigger AFAIK. You’ll probably have better luck asking this on your target mobile platform area (you didn’t mention which platform you target).

1 Like

I want to target both ios and android. I will try to make a build. I already found a video about it. While this is my first project I am a “noob” so I have to search for everything.Thank you for your time. One more question, do you ever used Unity Remote 5? I tryed to use it to test the game but I think I have some connection issues between my PC and phone(I have an iPhone X and a HP laptop with windows 10) because the app shuts down when I click on Play button.

UPDATE: I read the discutions in the forum and I understand what is the issue. I test it in unity by moving the mouse a bit and than I increase sensitivity. Now it is working even if I move the mouse a bit. Thank you for your help.

I still have this question:
“One more question, do you ever used Unity Remote 5? I tryed to use it to test the game but I think I have some connection issues between my PC and phone(I have an iPhone X and a HP laptop with windows 10) because the app shuts down when I click on Play button.”

@whiteshark01

You’ll have to ask someone else - I have used remote, but with different devices and it has been quite a while…

1 Like

Ok.Thank you. I solve the first problem.