Question by
BlackPie · Nov 19, 2015 at 07:05 PM ·
uiui imageinput.touch
can't detect touch on screen
hi. i'm having trouble detecting touch on screen. more precisely on canvas. here is my code:
void Update () {
if((Input.touchCount > 0) && (Input.GetTouch(0).phase == TouchPhase.Began))
{
Debug.Log("hi");
Vector2 v = Input.GetTouch(0).deltaPosition;
Debug.Log(v.x);
}
}
int never enters if. more so it never passes the Input.touchCount > 0
condition. this script is attached to an image in canvas. i want to get the coordinates of touch when player touches that image.
Comment
This may or may not be helpful for you, but I found T$$anonymous$$Touchkit by prime31 very helpful for working with touch input. It's free and it works great.
Your answer
Follow this Question
Related Questions
AUDIO DATA to STATIC WAVEFORM DISPLAY? 1 Answer
RectTransform Left Right Bottom Top 0 Answers
What Am I doing Wrong Here 1 Answer
Canvas not filling up the whole screen in Unity 5 0 Answers
Custom UI Material Issue 0 Answers