EditorGUI
- actionKey
- BoundsField
- ColorField
- CurveField
- DrawPreviewTexture
- DrawTextureAlpha
- DropShadowLabel
- EnumPopup
- FloatField
- Foldout
- indentLevel
- InspectorTitlebar
- IntField
- IntPopup
- IntSlider
- LabelField
- LayerField
- MinMaxSlider
- ObjectField
- PasswordField
- Popup
- PrefixLabel
- ProgressBar
- PropertyField
- RectField
- SelectableLabel
- Slider
- TagField
- TextArea
- TextField
- Toggle
- Vector2Field
- Vector3Field
- Vector4Field
EditorGUI.TagField 标签字段
static function TagField (position : Rect, tag : string, style : GUIStyle = EditorStyles.popup) : string
static function TagField (position : Rect, label : string, tag : string, style : GUIStyle = EditorStyles.popup) : string
static function TagField (position : Rect, label : GUIContent, tag : string, style : GUIStyle = EditorStyles.popup) : string
Parameters参数
- positionRectangle on the screen to use for the field.
屏幕上的矩形区域 - labelOptional label in front of the field.
该字段前面的可选标签 - tagThe tag the field shows.
显示的标签字段 - styleOptional GUIStyle. // 可选的GUIStyle
string - The tag selected by the user.
返回字符串 - 用户选择的标签
Description描述
Make a tag selection field.
制作一个标签选择字段。
Tag field in an Editor window.
在编辑器窗口的标签字段。
// Change the Tag and/or the layer of the selected GameObjects.
//更改标签 和/或 所选游戏物体的层
class EditorGUITagLayerField extends EditorWindow {
var selectedTag : String = "";
var selectedLayer : int = 0;
@MenuItem("Examples/Tag - Layer for Selection")
static function Init() {
var window = GetWindow(EditorGUITagLayerField);
window.position = Rect(0,0,350,70);
window.Show();
}
function OnGUI() {
selectedTag = EditorGUI.TagField(
Rect(3,3,position.width/2 - 6, 20),
"New Tag:",
selectedTag);
selectedLayer = EditorGUI.LayerField(
Rect(position.width/2 + 3,3, position.width/2 - 6, 20),
"New Layer:",
selectedLayer);
if(Selection.activeGameObject) {
if(GUI.Button(Rect(3,25,90,17),"Change Tags"))
for(var go : GameObject in Selection.gameObjects)
go.tag = selectedTag;
if(GUI.Button(Rect(position.width-96, 25,90,17),"Change Layers"))
for(var go : GameObject in Selection.gameObjects)
go.layer = selectedLayer;
}
}
function OnInspectorUpdate() {
Repaint();
}
}
最后修改:2011年6月22日 Wednesday 19:02