Include some convenient methods for editor GUI. More...
Static Public Member Functions | |
static float | GetLabelWidth (float viewWidth=0f) |
Get the label width within the specified view width. More... | |
static void | SetIconForObject (Object obj, Texture2D icon) |
Set the icon for the specified UnityEngine.Object to show in the Inspector or Project window. More... | |
static void | MultiFloatField (GUIContent label, GUIContent[] subLabels, float[] values, params GUILayoutOption[] options) |
Make a multi-control with text fields for entering multiple floats in the same line. More... | |
static Vector4 | Vector4Field (GUIContent label, Vector4 value, params GUILayoutOption[] options) |
Make an X, Y, Z and W field for entering a UnityEngine.Vector4 . More... | |
static Quaternion | QuaternionField (GUIContent label, Quaternion value, params GUILayoutOption[] options) |
Make an X, Y, Z and W field for entering a UnityEngine.Quaternion . More... | |
static string | SearchField (string text, Action onPopup=null, params GUILayoutOption[] options) |
Make a toolbar style search field, optional to set a callback invoked when click the magnifier popup icon. More... | |
static void | ErrorField (Rect rect, GUIContent label, GUIContent error) |
Display an error message after the prefix label. More... | |
static void | NamelessField (Rect rect, SerializedProperty property, string path="", bool border=false) |
Make a simple property field without the label, but still tooltip if exists. More... | |
static int | CheckClick (Rect rect, int button=0, bool ctrl=false, bool shift=false, bool alt=false) |
Check if click in the specified rect , optional to combine the modifier keys. More... | |
static bool | StartDragObjects (Rect rect, params Object[] sources) |
Try to start Drag'n'Drop the specified objects. More... | |
static bool | StartDragObjects (Rect rect, Func< IEnumerable< Object >> sourcer) |
Try to start Drag'n'Drop the specified objects. More... | |
static bool | StartDragPaths (Rect rect, params string[] sources) |
Try to start Drag'n'Drop the specified paths. More... | |
static bool | StartDragPaths (Rect rect, Func< IEnumerable< string >> sourcer) |
Try to start Drag'n'Drop the specified paths. More... | |
static Object[] | AcceptDragObjects (Rect rect, Func< Object, bool > filter) |
Try to accept Drag'n'Drop with the filtered dragged objects. More... | |
static Object[] | AcceptDragObjects (Rect rect, Func< IEnumerable< Object >, IEnumerable< Object >> filter=null) |
Try to accept Drag'n'Drop with the filtered dragged objects. More... | |
static string[] | AcceptDragPaths (Rect rect, Func< string, bool > filter) |
Try to accept Drag'n'Drop with the filtered dragged paths. More... | |
static string[] | AcceptDragPaths (Rect rect, Func< IEnumerable< string >, IEnumerable< string >> filter=null) |
Try to accept Drag'n'Drop with the filtered dragged paths. More... | |
Include some convenient methods for editor GUI.
3
|
static |
Get the label width within the specified view width.
Commonly used for a prefix label in a resizable window. Use EditorGUIUtility.currentViewWidth
instead if not assign.
viewWidth | View width. |
|
static |
Set the icon for the specified UnityEngine.Object
to show in the Inspector or Project window.
This wraps the internal EditorGUIUtility.SetIconForObject()
:
UnityEditor.MonoScript
declares the type.null
icon. The opposite methods below to get the icon:
AssetPreview.GetMiniThumbnail()
to get by UnityEngine.Object
.AssetPreview.GetMiniTypeThumbnail()
to get by System.Type
.EditorGUIUtility.ObjectContent()
to get by both. obj | Object. |
icon | Icon. |
|
static |
Make a multi-control with text fields for entering multiple floats in the same line.
Wrap EditorGUI.MultiFloatField()
as the GUI layout automatically.
label | Main label. |
subLabels | Sub labels. |
values | Values. |
options | Layout options. |
|
static |
Make an X, Y, Z and W field for entering a UnityEngine.Vector4
.
Copycat of EditorGUILayout.Vector4Field()
but use MultiFloatField()
. Contrast to original, this correct line wrap and indent level.
label | Label. |
value | Value. |
options | Layout options. |
|
static |
Make an X, Y, Z and W field for entering a UnityEngine.Quaternion
.
Just looks like Vector4Field()
.
label | Label. |
value | Value. |
options | Layout options. |
|
static |
Make a toolbar style search field, optional to set a callback invoked when click the magnifier popup icon.
text | The text to edit. |
onPopup | The popup callback. |
options | Layout options. |
|
static |
Display an error message after the prefix label.
rect | Rect. |
label | Label. |
error | Error message. |
|
static |
Make a simple property field without the label, but still tooltip if exists.
rect | Rect. |
property | Property. |
path | Relative property path. |
border | Background border. |
|
static |
Check if click in the specified rect
, optional to combine the modifier keys.
rect | Rect of the click area. |
button | The mouse button, 0 for left, 1 right and 2 middle button. |
ctrl | Combine modifier "Ctrl" or "Cmd". |
shift | Combine modifier "Shift". |
alt | Combine modifier "Alt". |
|
static |
Try to start Drag'n'Drop the specified objects.
rect | Rect. |
sources | Sources. |
true
if drag started.
|
static |
Try to start Drag'n'Drop the specified objects.
rect | Rect. |
sourcer | Callback to get sources, invoked only when mouse down or drag. |
true
if drag started.
|
static |
Try to start Drag'n'Drop the specified paths.
rect | Rect. |
sources | Sources. |
true
if drag started.
|
static |
Try to start Drag'n'Drop the specified paths.
rect | Rect. |
sourcer | Callback to get sources, invoked only when mouse down or drag. |
true
if drag started.
|
static |
Try to accept Drag'n'Drop with the filtered dragged objects.
rect | Rect. |
filter | Callback to filter each object, invoked only when drag updated. |
null
.
|
static |
Try to accept Drag'n'Drop with the filtered dragged objects.
rect | Rect. |
filter | Callback to filter all objects, invoked only when drag updated. |
null
.
|
static |
Try to accept Drag'n'Drop with the filtered dragged paths.
rect | Rect. |
filter | Callback to filter each path, invoked only when drag updated. |
null
.
|
static |
Try to accept Drag'n'Drop with the filtered dragged paths.
rect | Rect. |
filter | Callback to filter all paths, invoked only when drag updated. |
null
.