Unity3D GUI 控制項一覽

來源:互聯網
上載者:User

void OnGUI() {

  GUI.Label(new
Rect(1,1,100,20),"I'm
a Label"); //1

  GUI.Box(new
Rect(1,21,100,20),"I'm
a Box"); //2

  GUI.Button(new
Rect(1,41,100,20),"I'm
a Button"); //3

  GUI.RepeatButton(new
Rect(1,61,120,20),"I'm
a RepeatButton"); //4

  GUI.TextField(new
Rect(1,81,100,20),"I'm
a TextFielld"); //5

  GUI.TextArea(new
Rect(1,101,100,40),"I'm
a TextArea,\nMultiline"); //6

  GUI.Toggle(new
Rect(1,141,120,20),true,"I'm
a Toggle true"); //7

  GUI.Toggle(new
Rect(1,161,120,20),false,"I'm
a Toggle false"); //8

  GUI.Toolbar(new
Rect(1,181,160,20),-1,["Toolbar","Tool2","Tool3"]); //9

  GUI.SelectionGrid(new
Rect(1,201,190,20),2,["Selection","Grid","select3"],3);//10

  GUI.HorizontalSlider(new
Rect(1,221,180,20),3.0,0,10.0); //11

  GUI.VerticalScrollbar(new
Rect(1,241,20,100),3.0,1,0.0,10.0); //12

 

  //13

  GUI.BeginScrollView (new
Rect (200,10,100,100),Vector2.zero, new
Rect (0, 0, 220,200));

  GUI.Label(new
Rect(0,0,100,20),"I'm
a Label");

  GUI.EndScrollView();

  //14

    GUI.Window(0,new
Rect(200,129,100,100),funcwin,"window");

}

 

function funcwin(windowID:int)

 {

  GUI.DragWindow(Rect(0,0,10000,2000));

 }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.