アットウィキロゴ

▼常にGameウィンドウ内にGUIを表示

@script ExecuteInEditMode()


▼GUI描画

function OnGUI (){

	//ボタン等をここに追加
}


▼ボタン

if (GUI.Button(Rect (xxx,yyy,www,hhh), "ボタン")){

}

▼ボックス

GUI.Box (Rect(xxx,yyy,www,hhh), "ボックス");

▼ラベル

GUI.Label(Rect(xxx,yyy,www,hhh), "ラベル");

▼テキストボックス(1行)

GUI.TextField(Rect(xxx,yyy,www,hhh), "テキスト");

▼テキストボックス(複数行)

GUI.TextArea(Rect(xxx,yyy,www,hhh), "テキスト1\nテキスト2\nテキスト3");


▼スクロールバー

private var ppp : Vector2;

function Update (){
	if( Input.touchCount > 0 ){
		var touch = Input.touches[0];
		if (touch.phase == TouchPhase.Moved){
			ppp.y += touch.deltaPosition.y;
		}
	}
}

function OnGUI(){
	var aaa : Rect = Rect(xxx1,yyy1,www1,hhh1); //スライドの描画領域
	var bbb : Rect = Rect(xxx1,yyy1,www2,hhh2); //スライドの中身

	ppp = GUI.BeginScrollView(aaa, ppp, bbb);

	//スクロールさせたいボタン等をここに追加

	GUI.EndScrollView();
}

水平スライダーバーを0~100まで0.5刻みにする

GUI.HorizontalSlider(Rect(xxx,yyy,www,hhh),Mathf.Round((Mathf.Round(fff*10)/10)*2)/2,0,100);


スタイル(スキン)設定

var sss  : GUIStyle;

function OnGUI (){
	GUI.skin.button = sss;
}

スライダーバーのツマミ部分のスタイル設定時の注意!

※ 「Fixed Width」と「Fixed Height」に数値を入れないと表示されないので注意!!


フォントサイズをスクリプトで変更

sss.fontSize = 123;


リンク



最終更新:2013年10月12日 15:36