IGEditorUtils Class

Summary

[Editor-Only] Various utility methods used by InspectorGadgets.
graph BT Type-->Base0["Object"] Type["IGEditorUtils"] class Type type-node

Syntax

public static class IGEditorUtils

Fields

Name Constant Value Summary
AnyAccessBindings 60
Commonly used System.Reflection.BindingFlags.
static
InstanceBindings 52
Commonly used System.Reflection.BindingFlags.
static
StaticBindings 56
Commonly used System.Reflection.BindingFlags.
static

Properties

Name Value Summary
DefaultEditorState EditorState
Determines when to show Inspectable attributes if not specified in their constructor.
static
DontExpandWidth GUILayoutOption[]
A single UnityEngine.GUILayoutOption created by passing false into UnityEngine.GUILayout.ExpandWidth(System.Boolean).
static
IndentSize float
The number of pixels of indentation for each UnityEditor.EditorGUI.indentLevel increment.
static
MoveSnapVector Vector3
Wraps UnityEditor.EditorSnapSettings.move.
static
RotationSnap float
Wraps UnityEditor.EditorSnapSettings.rotate.
static
RotationSnapVector Vector3
(InspectorGadgets.Editor.IGEditorUtils.RotationSnap, InspectorGadgets.Editor.IGEditorUtils.RotationSnap, InspectorGadgets.Editor.IGEditorUtils.RotationSnap).
static
ScaleSnap float
Wraps UnityEditor.EditorSnapSettings.scale.
static
ScaleSnapVector Vector3
(InspectorGadgets.Editor.IGEditorUtils.ScaleSnap, InspectorGadgets.Editor.IGEditorUtils.ScaleSnap, InspectorGadgets.Editor.IGEditorUtils.ScaleSnap).
static
Spacing float
UnityEditor.EditorGUIUtility.standardVerticalSpacing. This value is 2 in Unity 2018.
static

Methods

Name Value Summary
AllBackslashes(string) string
Replaces any forward slashes with backslashes: / -> \.
static
AppendColorTag(StringBuilder, Color32, string) void
Appends the a rich text color tag around the `message`.
static
AppendColorToHex(StringBuilder, Color32) void
Appends the hexadecimal representation of `color`.
static
CalculateWidth(GUIStyle, GUIContent) float
Calls UnityEngine.GUIStyle.CalcMinMaxWidth(UnityEngine.GUIContent,System.Single@,System.Single@) and returns the max width.
static
CalculateWidth(GUIStyle, string) float
Calls UnityEngine.GUIStyle.CalcMinMaxWidth(UnityEngine.GUIContent,System.Single@,System.Single@) and returns the max width.
static
ColorToHex(Color32) string
Returns a string containing the hexadecimal representation of `color`.
static
DoDelegateGUI(Rect, Delegate) void
Draw the target and name of the specified System.Delegate.
static
DoInspectableGUI(Object[]) void
[Pro-Only] Draws the GUI for all InspectorGadgets.Attributes.BaseInspectableAttributes of the `targets`.
static
DoLayerMaskField(Rect, GUIContent, int) int
Make a field for layer masks.
static
FindAssetGuidsOfType(Type) string[]
Calls UnityEditor.AssetDatabase.FindAssets(System.String,System.String[]) using the specified `type` as the filter.

If the `type` inherits from UnityEngine.Component then it will instead use UnityEngine.GameObject as the filter to find all Prefabs (since Unity won't find UnityEngine.Component types directly).
static
FindAssetOfType(Type, string) Object
Searches through all assets of the specified `type` and returns the one with a name closest to the `nameHint`.
static
ForEachProperty(SerializedObject, bool, Action<SerializedProperty>) void
Calls the specified `method` for each UnityEditor.SerializedProperty in the `serializedObject` then applies any modified properties.
static
GetCachedStyle(Func<GUIStyle>) GUIStyle
Creates a UnityEngine.GUIStyle using the provided delegate and caches it so the same style can be returned when this method is called again for the same delegate.
static
GetCurrentCameraTransform() Transform
Gets the transform of an available camera from a scene view or the scene.
static
GetCurrentCameraTransform(Vector3, Quaternion) void
Gets the transform of an available camera from a scene view or the scene.
static
GetDefaultFileExtension(Type) string
Returns the default file extension for a type derived from UnityEngine.Object.
static
GetSceneCameraTransform() Transform
Gets the transform of an available camera from a scene view.
static
GetSceneViewCameraTransform() Transform
Gets the transform of an available camera from a scene view.
static
GetSensitivity(bool, bool, float) float
Returns a value of 1 multiplied if `fast` and divided if `slow`.
static
GetSensitivity(Event, float) float
Returns a value of 1 multiplied if UnityEngine.Event.shift and divided if UnityEngine.Event.control.
static
GetSensitivity(float) float
Returns a value of 1 multiplied if UnityEngine.Event.shift and divided if UnityEngine.Event.control.
static
GetSerializedPropertyContext(SerializedProperty) IDisposable
Returns a disposable context that will allow copy and paste commands to be executed on the `property`.
static
GroupedInvoke(MenuCommand, Action<List<Object>>) void
When a context menu function is executed with multiple objects selected, it calls the method once for each object. Passing each `command` into this method will group them all into a list and invoke the specified `method` once they have all been gathered.
static
IsNow(EditorState) bool
Returns true if the Unity Editor is currently in the specified `state`.
static
IsSnapped(float, float) bool
Returns true if `value` is approximately equal to a multiple of `snap`.
static
OnSceneGUI(Action, bool) Action
Registers the specified method to be called while drawing the UnityEditor.SceneView GUI.
static
OnSceneGUI(Action, Func<bool>, bool) void
Registers the specified method to be called while drawing the UnityEditor.SceneView GUI.
static
OnSceneGUI(Action, Object, bool) Action
Registers the specified method to be called while drawing the UnityEditor.SceneView GUI.
static
Snap(float, float) float
Snaps the given `value` to a grid with the specified `snap` size.
static
SnapPosition(Vector3) Vector3
Snaps the given `position` to the grid (as specified in Edit/Snap Settings).
static
SnapPosition(Vector3, int) Vector3
Snaps the given `position` to the grid on the specified axis (as specified in Edit/Snap Settings).
static
SnapRotation(Quaternion) Quaternion
Snaps the given `rotation` to the nearest snap increment on all axes (as specified in Edit/Snap Settings).
static
SnapRotation(Quaternion, int) Quaternion
Snaps the given `rotation` to the nearest snap increment on the specified axis (as specified in Edit/Snap Settings).
static
SnapRotation(Vector3) Vector3
Snaps the given `rotationEuler` to the nearest snap increment on all axes (as specified in Edit/Snap Settings).
static
SnapRotation(Vector3, int) Vector3
Snaps the given `rotationEuler` to the nearest snap increment on the specified axis (as specified in Edit/Snap Settings).
static
SnapScale(Vector3) Vector3
Snaps the given `scale` to the nearest snap increment on all axes (as specified in Edit/Snap Settings).
static
SnapScale(Vector3, int) Vector3
Snaps the given `scale` to the nearest snap increment on the specified axis (as specified in Edit/Snap Settings).
static
StealFromLeft(Rect, float) Rect
Subtracts the `width` from the left side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
StealFromLeft(Rect, float, RectOffset) Rect
Subtracts the `width` from the left side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
StealFromRight(Rect, float) Rect
Subtracts the `width` from the right side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
StealFromRight(Rect, float, RectOffset) Rect
Subtracts the `width` from the right side of the `area` and returns a new UnityEngine.Rect occupying the removed section.
static
TempContent(string, string) GUIContent
Creates and returns a UnityEngine.GUIContent with the specified parameters on the first call and then simply returns the same one with new parameters on each subsequent call.
static
ValueOrDefault(Nullable<EditorState>) EditorState
Returns the `state` as long as it isn't null. Otherwise returns the InspectorGadgets.Editor.IGEditorUtils.DefaultEditorState.
static