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*,ScaleMode.ScaleToFit,true);*

}
GUI.EndScrollView();
or is way to use default android scroll view object ?

1 Answer

1

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.