- Home /
UI Touch Events not working?
Hey all,
I've been trying to implement Unity ads into my android game and I'm currently using a touch event like so.
// Begin touch listener
for (int i = 0; i < Input.touchCount; ++i) {
if (Input.GetTouch(i).phase == TouchPhase.Began) {
// TO-DO: Have player launch
player.MovePlayer();
}
}
I've been trying to use a UI Button to show the ads on my device, however when I touch the button it highlights, but doesn't call the function to show the ads. I'm worried that my above code may have screwed up my UI elements in-game.
Does anyone know what I can do to correct this issue? Many thanks in advance.
Answer by Priyanshu · Apr 23, 2015 at 05:48 AM
Unity now uses event system to handle touch Input. You can call functions from Buttons using Inspector now. Try this Tutorial.
I think you misunderstand me, I know how to do buttons and such, but it seems that on my device the button won't work, ins$$anonymous$$d it just moves my player as expected.
Your answer
![](https://koobas.hobune.stream/wayback/20220613193827im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to Activate UI in an Array Using C# 1 Answer
Failed to convert sprite texture type in unity UI 0 Answers
Making a dynamic radar type graph 3 Answers