Unity GUI

Unity は、GUI Scripting Guideというものがあります。
http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html

下記のような感じで、ボタンやラベルなどが生成できます。

function OnGUI () {
	GUI.Box (Rect (10,10,100,90), "Loader Menu");

	if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
		Application.LoadLevel (1);
	}

	if (GUI.Button (Rect (20,70,80,20), "Level 2")) {
		Application.LoadLevel (2);
	}
}

これをFlashコンテンツにしてAIRに入れると下記のようになります。

簡単なUIはそろっているのでSkinを変えたりすれば実用レベルだ。

簡単な作り方
1. [File]メニュー→[New Project]でプロジェクト作成
2. [Assets]メニュー→[Create]→[JavaScript]でスクリプトを定義
3. [GameObject]メニュー→[Create Empty]で左下の[Hierarchy]に追加
4. [Hierarchy]ビューに追加したGameObjectを選択する
5. [Component]メニュー→[Script]→[NewBehaviourScript]を選択
6. 右の[Inspector]ビューに[NewBehaviourScript]が追加
7. [Inspector]タブの[NewBehaviourScript]の歯車をクリックして[Edit Script]で編集可能
8. 上部真ん中の再生ボタンを押して実行

government,politics news,politics news,politics
 

タグ: ,

コメントは受け付けていません。