using UnityEngine;
using System.Collections;
public class scrollView : MonoBehaviour {
private Vector2 scrollViewVector = Vector2.zero;
public TextAsset asset;
private string innerText = " ";
void OnGUI () {
// Begin the ScrollView
scrollViewVector = GUI.BeginScrollView (new Rect (Screen.width - 400,0, 400, 400),
scrollViewVector, new Rect (Screen.width - 400,0, 800, 800));
// Put something inside the ScrollView
innerText = GUI.TextArea (new Rect (Screen.width - 400,0, 800, 800), asset.text);//窗口的比例需保持在1/4.才能正确显示滑竿和文字的关系。
// End the ScrollView
GUI.EndScrollView();
}
}
var asset : TextAsset;
function Start () {
print(asset.text);
}