EditorGUI.RectField 矩形字段


static function RectField (position : Rect, value : Rect) : Rect
static function RectField (position : Rect, label : string, value : Rect) : Rect
static function RectField (position : Rect, label : GUIContent, value : Rect) : Rect

Parameters参数

  • position
    Rectangle on the screen to use for the field.
    屏幕上的矩形区域    
  • label
    Optional label to display above the field.
       该字段上面显示的可选标签    
  • value
    The value to edit. // 编辑的值

Returns

Rect - The value entered by the user.

返回Rect - 用户输入的值。

Description描述

Make an X, Y, W & H field for entering a Rect.

制作一个X、Y、W和H的输入框,用来输入Rect值。

EditorGUI.RectField 矩形字段

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);}}}


,