Question by
hadikh · Jul 29, 2017 at 05:36 PM ·
inputscrollviewgettouch
detect swipe end
hello , i'm having a problem in the "scroll view" in unity, if i'm swiping and i started on an object let's say named "1" and ended on an object named "5", the input will be taken on the object 1.. what i want is while swiping to not take any input .Here is the script:
if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Ended) {
Vector2 test = Camera.main.ScreenToWorldPoint (Input.GetTouch (0).position);
RaycastHit2D hit = Physics2D.Raycast (test, (Input.GetTouch (0).position));
if (hit != null && hit.collider != null) {
Debug.Log ("I'm hitting " + hit.collider.name);
}
for (int i = 0; i < 10; i++) {
if (hit.transform.gameObject.name == ("" + (i))) {
selected = i;
Debug.Log ((selected));
}
}
}
Thank you for your answers
Comment