#pragma strict var scrollPosition:Vector2; function Start () { scrollPosition[0]=50; scrollPosition[1]=50; } function Update () { } function OnGUI() { scrollPosition=GUI.BeginScrollView(Rect(0,0,200,200),scrollPosition, Rect(0,0,Screen.width,300),true,true); GUI.Label(Rect(100,40,Screen.width,30),"测试滚动试图,测试滚动试图,测试滚动试图,测试滚动试图"); GUI.EndScrollView(); }
#pragma strict var viewTexture0:Texture2D; var viewTexture1:Texture2D; function Start () { } function Update () { } function OnGUI() { //开始群组 GUI.BeginGroup(new Rect(10,50,200,400)); GUI.DrawTexture(Rect(10,20,viewTexture0.width,viewTexture0.height),viewTexture0); GUI.Label(Rect(10,150,100,40),"群组视图1"); GUI.Button(Rect(10,190,100,40),"按钮"); GUI.EndGroup(); //开始群组 GUI.BeginGroup(new Rect(300,0,500,400)); GUI.DrawTexture(Rect(10,20,viewTexture0.width,viewTexture0.height),viewTexture0); GUI.Label(Rect(10,150,100,40),"群组视图2"); GUI.Button(Rect(10,190,100,40),"按钮"); GUI.EndGroup(); }