Version: 2017.3
public static Rect RectField (Rect position, Rect value);
public static Rect RectField (Rect position, string label, Rect value);
public static Rect RectField (Rect position, GUIContent label, Rect value);

パラメーター

position 表示位置
label フィールドのラベル
value 編集する値

戻り値

Rect ユーザーによって設定された値

説明

Rect を入力する X 、 Y 、 W と H のフィールドを作成します。


Rect field in an Editor Window.

// Find all the cameras in the scene and shows all their viewports togheter

class EditorGUIRectField extends EditorWindow {

var cameras : Camera[];

@MenuItem("Examples/Editor GUI RectField usage") static function Init() { var window = GetWindow(EditorGUIRectField); window.position = Rect(0,0,150,120); window.Show(); }

function OnGUI() { if(GUI.Button(Rect(3,3,position.width-6,20),"Update list")) cameras = FindObjectsOfType(Camera);

if(cameras) for(var i = 0; i < cameras.Length; i++) { cameras[i].rect = EditorGUI.RectField( Rect(3,25+45*i,position.width - 6, 25), cameras[i].name, cameras[i].rect); } } }

説明

SerializedProperty を使用して Rect の X 、 Y 、 W と H のフィールドを作成します(一般的ではありません) 。