Unity3d ScrollView And Drag

Ref: http://answers.unity3d.com/questions/17347/any-examples-of-an-iphone-like-scrollview-using-un.html

 

using UnityEngine; 
using System.Collections;
 
public class scrollView : MonoBehaviour {
 
Vector2 scrollPosition;
Touch touch;
 // The string to display inside the scrollview. 2 buttons below add & clear this string.
 string longString = "This is a long-ish string";
 
 void OnGUI () { 
 
     scrollPosition = GUI.BeginScrollView(new Rect(110,50,130,150),scrollPosition, new Rect(110,50,130,560),GUIStyle.none,GUIStyle.none);
 
     for(int i = 0;i < 20; i++)
     {
         GUI.Box(new Rect(110,50+i*28,100,25),"xxxx_"+i);
     }
     GUI.EndScrollView ();
 }
 
 void Update()
 {
     if(Input.touchCount > 0)
     {
         touch = Input.touches[0];
         if (touch.phase == TouchPhase.Moved)
         {
             scrollPosition.y += touch.deltaPosition.y;
         }
     }
 }
 }

 

Unity Asset Store Download Package Path

Mac
พิมพ์ “open ~/Library/Unity/Asset Store” ใน terminal

Window
เข้าไปตามนี้เลย “C:UsersaccountNameAppDataRoamingUnityAsset Store” 

แต่ใน Window อันนี้ไม่แน่ใจเพราะ ไม่ได้ใช้ win นะ