- Home /
Detecting Android tap
Hi, I must be missing something. I'm trying to detect a simple tap, for instance on my start button on the splash page. I will be using this for both Android and iOS. Here's the script:
void Update () { if (Input.touchCount > 0) { print(Input.touchCount); Application.LoadLevel(2); } }
your start button is missing in this script. you load level 2 if there is any touch. If level 2 is not loading, it might not be added to the build settings.
Answer by vickygroups · Apr 04, 2014 at 10:01 PM
Thank you, Koray. how do I specify the button? Can I put the argument into it? I was also reading that Android doesn't like Input.touchCount, and was thinking of using touch.phase, but the instructions are confusing. Could I do:
void Update () { Touch touch = Input.GetTouch(0);
if ((touch.phase == TouchPhase.Began) && (guiTexture.HitTest(touch.position)))
{
Application.LoadLevel(2);
audio.Play ();
}
}
Your answer
Follow this Question
Related Questions
instantiate object on tap 1 Answer
UI Buttons not always working on Android? 0 Answers
Selectable Objects? Android tap 1 Answer
iPhone and Android difference? 0 Answers
Menu on Android Application 1 Answer