EditorGUILayout
- BeginHorizontal
- BeginScrollView
- BeginToggleGroup
- BeginVertical
- BoundsField
- ColorField
- CurveField
- EndHorizontal
- EndScrollView
- EndToggleGroup
- EndVertical
- EnumPopup
- FloatField
- Foldout
- InspectorTitlebar
- IntField
- IntPopup
- IntSlider
- LabelField
- LayerField
- MinMaxSlider
- ObjectField
- PasswordField
- Popup
- PrefixLabel
- PropertyField
- RectField
- SelectableLabel
- Slider
- Space
- TagField
- TextArea
- TextField
- Toggle
- Vector2Field
- Vector3Field
- Vector4Field
EditorGUILayout.ColorField 颜色字段
static function ColorField (value : Color, params options : GUILayoutOption[]) : Color
static function ColorField (label : string, value : Color, params options : GUILayoutOption[]) : Color
static function ColorField (label : GUIContent, value : Color, params options : GUILayoutOption[]) : Color
Parameters参数
-
labelOptional label in front of the field. // 字段前面的可选标签。
-
valueThe value to edit. // 编辑的值
-
optionsAn optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style. See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。
Color - The color selected by the user.
返回Color,由用户输入的值。
Description描述
Make a field for selecting a Color.
制作一个用于选择颜色的字段。
Change the color of the selected GameObjects.
改变选择游戏物体的颜色。
// Change The color of the selected Game Objects
//改变选择游戏物体的颜色。
class MassiveColorChange extends EditorWindow {
var matColor : Color = Color.white;
@MenuItem("Examples/Massive Color Change")
static function Init() {
var window = GetWindow(MassiveColorChange);
window.Show();
}
function OnGUI() {
matColor = EditorGUILayout.ColorField("New Color", matColor);
if(GUILayout.Button("Change!"))
ChangeColors();
}
function ChangeColors() {
if(Selection.activeGameObject)
for(var t in Selection.gameObjects)
if(t.renderer)
t.renderer.sharedMaterial.color = matColor;
}
}
最后修改:2011年7月14日 Thursday 17:22