- Home /
how can create touch screen android scroll in unity3d?
I want create a android game with unity3d . this game have upgrade list with touchable scroll. I use this code for create that but when move finger in touch screen, scroll move hard and with jump , I want move softly and like android effects.
scrollPosition1 = GUI.BeginScrollView(Rect (0,400,Screen.width,175),scrollPosition1, Rect (0, 0, 650, 0));
// touch screen
if (Input.touchCount==1 &&Screen.height -Input.GetTouch(0).position.y > 450 - scrollPositionHome.y && Screen.height - Input.GetTouch(0).position.y < 600 - scrollPositionHome.y )
{
var touchDelta2 : Vector2 = Input.GetTouch(0).deltaPosition;
scrollPosition1.x +=touchDelta2.x;
}
for (i=0;i < ImgSliderProducts.Length;i++)
{
GUI.DrawTexture(Rect(20+(i* 100),10,100,100), ImgSliderProducts[i],ScaleMode.ScaleToFit,true);
}
GUI.EndScrollView();
or is way to use default android scroll view object ?
Answer by haim96 · Dec 07, 2013 at 01:27 PM
i'm not great in codding and probably could write you one if i have enough time but i can tell that for smooth movement you should use LERP and probably it will be much better to put all in coroutine some how instead of using just FOR loop.
Your answer
Follow this Question
Related Questions
ScrollView disappears shortly after starting the game (Android) 1 Answer
Problem with Android Keyboard/TextField 1 Answer
uGUI button doesn't work on touch monitor 0 Answers
Android Input 1 Answer
Scroll view/rect broken on Android only 0 Answers