2013-10-01 23 views

回答

0

我找到了。必須拿到觸摸屏pos並設置一個移動範圍。

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; 
     } 
     GUI.skin.font = fnt; 
     style.normal.textColor = Color.black; 
     style.alignment = TextAnchor.MiddleRight; 
     for (i=0;i < ImgSliderProducts.Length;i++) 
     { 
      GUI.DrawTexture(Rect(20+(i* 100),10,100,100), ImgSliderProducts[i],ScaleMode.ScaleToFit,true); 
     } 
GUI.EndScrollView();