- Home /
Input.GetMouseButton not working on mobile
I built my game to mobile, but a script that is supposed to be called when I hold down my tap (Input.GetMouseButton) is not working. What is happening, and how can I fix this.
Comment
Best Answer
Answer by Ruzihm · Dec 20, 2019 at 06:54 PM
Check if there are any touches and if there are, check the phase on the first touch
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary)
{
// touch is continuing
}
}
Answer by holyPraline · Dec 19, 2019 at 08:49 PM
Instead use "Input.getmousebuttondown(0)" for mobile.
I need to tell if the player is holding down the tap, not just tapping once.
Your answer
![](https://koobas.hobune.stream/wayback/20220612220415im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Pushing without compiling 4 Answers
Delta event out of Editor Problem 4 Answers
How can I get Unity to respect mcs.rsp changes between multiple builds? 0 Answers