言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

GUI.depth

public static var depth: int;

Description

現在実行中のGUI動作のデプス

これは同時に実行されている他のスクリプトのGUIとの描画順を制御するために設定します。 depthが低い値のGUI要素は高い値のGUI要素より上に描画されます(たとえばカメラからの「距離」をデプスと考えることができます) 注意: この例を動かすにはスクリプトを2つ作成する必要があります。 スクリプトファイル名とクラス名を同じにした場合は 動かないことを忘れないようにしましょう。
背後に他のボタン

	// Makes this button go back in depth over the example2 class one.

	class example1 extends MonoBehaviour {
		static var guiDepth : int = 0;
		function OnGUI() {
			GUI.depth = guiDepth;
			if(GUI.RepeatButton(Rect(0,0,100,100), "GoBack")) {
				guiDepth = 1;
				example2.guiDepth = 0;
			}
		}
	}

そして別のスクリプトにこの例のコードをコピーします

	// Makes this button go back in depth over the example1 class one.

	class example2 extends MonoBehaviour { 
		static var guiDepth : int = 1;
		function OnGUI() {
			GUI.depth = guiDepth;
			if(GUI.RepeatButton(Rect(50,50,100,100), "GoBack")) {
				guiDepth = 1;
				example1.guiDepth = 0;
			}
		}
	}