This class contains a variety of functions. Some are used to make accessing SerializedObjects a little easier, and others are for drawing specialized controls.

Detailed Description

Classes

class  GUIState
 Stores the GUI status. Status includes: the indent level, hierarchyMode, and enabled/disabled state. Use the EditorUtil function RecordGUIState, RecordGUIStateAndSetToDefault,SetGUIStateToDefault,RestoreGUIState, or access the members manually. A rect can also be stored with the record functions, but not automatically restored.
 

Public Member Functions

delegate object DrawListItemDelegate (GUIContent label, object listElement)
 This delegate defines a function that will be used to draw individual elements of a list. The object parameter represents the starting value, and the returned object represents the new, possibly user-adjusted, value.
 

Static Public Member Functions

static void BeginDarkenedBox (Rect unindentedDrawRect)
 Draws a box, with a border, at the specified location and size, and darkens the background in it using BeginDarken.
A Matching EndBorderOrDarkendBox must be invoked, after drawing the contents of the box, to restore colors to their previous state.
 
static object DrawObjectDefault< T > (Rect position, GUIContent label, object objectToDraw)
 Utility function that draws the appropriate control based upon the type parameter T.
When a particular type is specified, it matches the signature of the DrawListItemDelegate. The object parameter represents the starting value, and the returned object represents the new, possibly user-adjusted, value.
 
static object DrawObjectDefaultLayout< T > (GUIContent label, object objectToDraw)
 Utility function that draws the appropriate control based upon the type parameter T.
When a particular type is specified, it matches the signature of the DrawListItemDelegate. The object parameter represents the starting value, and the returned object represents the new, possibly user-adjusted, value.
 
static void EndDarkenedBox ()
 Used to restore the state of colors after the background is darkened by BeginBorderBox or BeginDarkenedBox
 
static void FoldoutObjectProperty (Rect position, SerializedProperty prop, GUIContent label, System.Type type, bool allowSceneObjects, bool allowCreation, params GUILayoutOption[] options)
 Manual-Layout version of FoldoutObjectProperty property-drawing function. Shows a standard Unity ObjectField, with some additions. If appropriate this drawer will allow the property to be folded-up/out to see the children members of the SerializedProperty object. It will also prove a save button if appropriate (Derived from ScriptableObject). Will draw a foldout-able, and (if a SerilazbleObject) savable property.
 
static Texture2D FrameTex ()
 Generates an 8x8 border texture with a transparent interior and black edges.
 
static float GetFoldoutObjectPropertyHeight (SerializedProperty prop, GUIContent label)
 Get the height of a FoldoutObjectProperty control. Takes into account the foldout state of the control.
 
static void LayoutFoldoutObjectProperty (SerializedProperty prop, GUIContent label=null, System.Type type=null, bool allowSceneObjects=true, bool allowCreation=true, params GUILayoutOption[] options)
 Auto-Layout version of FoldoutObjectProperty property-drawing function. Shows a standard Unity ObjectField, with some additions. If appropriate this drawer will allow the property to be folded-up/out to see the children members of the SerializedProperty object. It will also prove a save button if appropriate (Derived from ScriptableObject). Will draw a foldout-able, and (if a SerilazbleObject) savable property.
 
static void LayoutSeperator (bool addSpace)
 Draws a horizontal Separator using AutoLayout
 
static void LayoutSeperator (GUIContent titleText)
 Draws a horizontal Separator using AutoLayout
 
static void LayoutSeperator (string titleText)
 Draws a horizontal Separator using AutoLayout
 
static void RecordGUIState (Rect position=new Rect())
 Records the current GUI state. After this is called, the user may then make any changes to the GUI states, and then restore the previously recorded state with a single call to RestoreGUIState.
 
static void RecordGUIStateAndSetToDefault (Rect position=new Rect())
 Records the current GUI state, then sets the current GUI states to default. After this is called, the user may then make any changes to the GUI states (or not), and then restore the previously recorded state with a single call to RestoreGUIState.
 
static void RestoreGUIState ()
 Restores the last recorded GUI State back to the current GUI state.
 
static void SetGUIStateToDefault ()
 Assigns the states in the defaultState to the current GUI state.
 
static List< T > SimpleListFieldLayout< T > (GUIContent label, List< T > listToDisplay, DrawListItemDelegate drawListItemFunction=null, T defaultNewValue=default(T), bool numberElements=true)
 This function takes a List of type T, and displays it using standard EditorGUILayout controls. The list need not be serialized.
 
static void StringListAsMaskProperty (Rect position, SerializedProperty property, GUIContent label, string[] fullList)
 This property drawing function will display a SerializedProperty, that represents and array of strings, as list of selectable options.
Before and after the function is called, the Property will only contain the list of "selected" strings. Another parameter, fullList will provide ALL the selectable options, including those "not-selected" strings (which would NOT be stored in the SerialiedProperty).
 
static System.Type TypeOfCustomPropertyDrawer (System.Type drawerForType)
 Returns the type of the Custom PropertyDrawer, if any, for the specified runtime type.
 
static System.Type TypePopup (GUIContent label, System.Type currentSelection, System.Type onlyDecendantsOf, out List< System.Type > casheListRef, bool useFullName=false)
 Generate a pop-up that displays a list of Types for selection. Note: the list used in this pop-up is cached internally, but recomputed every time this function is called with a different onlyDecendantsOf type.
 

Static Public Attributes

static Color currentBackgroundColor
 This member is pubic for setup purposes only, it should not be set directly by the user, as it is used by Begin/End DarkenBackground
 
static float foldoutDarkenFactor
 Set by project-settings specified how MUCH to darken each time BeginDarken is called.
 
static int maxTextLinesHeight
 When using Multi-line ExposedMembers for strings- this value will define the maximum number of lines the text may grow to, before a scroll bar is needed.
 
static int pixelsPerTab
 Offset to use when manually computing indentation offsets.
 
static GUIState recordedState
 The currently recorded GUIstate.
Use the RecordGUIState or RecordGUIStateAndSetToDefault to store this value based on the current GUI state. Use the RestoreGUIState to assign all the recordedState values to the current GUI state.
 

Properties

static GUIState defaultState [get]
 The default state for the GUI is indentLevel=0, hierarchyMode = false, enabled = true, originalPostion = new Rect()
 
+ Collaboration diagram for EditorUtil: