Hi,
I have a series of plane in a straight line round about 8-10 which are displayed on when the scenes starts, and few more when user scrolls along the line and Along with it when user touch
(rather click one can say ) a new GameObject
is generated. Earlier i used a background to check for TouchPhase.Moved
event and Input.GetMouseButtonDown(0)
for determining that Plane
is touch
(click ). But how can I do scrolling and touch events on the plane itself ,like i have touched plane so generate new gameobject and yeah i have drag/moved so lets just scroll. When i write the touch
part using TouchPhase
when scrolling it takes the touch and the new GameObject is generated when I Touch
for Scrolling
. I am pasting snipet of scrolling part.
if(Input.touchCount == 1 && Input.GetTouch(0).phase==TouchPhase.Began)
{
scrollStartPosition=Input.GetTouch(0).position;
scrollEndPosition=scrollStartPosition;
}
else if(Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Moved)
{
scrollEndPosition=Input.GetTouch(0).position;
var distance=scrollEndPosition.x-scrollStartPosition.x;
if(distance<0 && Input.GetTouch(0).deltaPosition.x<3)
{
//Scroll on RIGHT SIDE
}
else if(distance>0 && Input.GetTouch(0).deltaPosition.x>-3)
{
//Scroll on Left SIDE
}
}