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.ColorField 颜色字段
static function ColorField (position : Rect, value : Color) : Color
static function ColorField (position : Rect, label : string, value : Color) : Color
static function ColorField (position : Rect, label : GUIContent, value : Color) : Color
Parameters参数
- positionRectangle on the screen to use for the field.
屏幕上的矩形区域 - labelOptional label to display above the field.
该字段上面显示的可选标签 - valueThe value to edit. // 编辑的值
Color - The color selected by the user.
返回Color - 用户输入的值。
Description描述
Make a field for selecting a Color.
制作一个颜色字段,用来选择颜色。
Color field in an Editor Window.
在编辑器窗口中的颜色字段。
// Change The color of the selected Game Objects
//改变的选择游戏物体颜色
class EditorGUIColorField extends EditorWindow {
var matColor : Color = Color.white;
@MenuItem("Examples/Massive Color Change")
static function Init() {
var window = GetWindow(EditorGUIColorField);
window.position = Rect(0,0,170,60);
window.Show();
}
function OnGUI() {
matColor = EditorGUI.ColorField(Rect(3,3,position.width - 6, 15),
"New Color:",
matColor);
if(GUI.Button(Rect(3,25,position.width-6, 30),"Change!"))
ChangeColors();
}
function ChangeColors() {
if(Selection.activeGameObject)
for(var t in Selection.gameObjects)
if(t.renderer)
t.renderer.sharedMaterial.color = matColor;
}
}
最后修改:2011年6月23日 Thursday 17:53