Namespace: | Sirenix.Utilities.Editor |
Assembly: | Sirenix.Utilities.Editor |
public static class GUIHelper
public static bool RepaintRequested
public static float ActualLabelWidth { get; set; }
public static float BetterContextWidth { get; set; }
public static float BetterLabelWidth { get; set; }
public static float ContextWidth { get; }
public static float CurrentIndentAmount { get; }
public static EditorWindow CurrentWindow { get; }
public static RectOffset CurrentWindowBorderSize { get; }
public static bool CurrentWindowHasFocus { get; }
public static int CurrentWindowInstanceID { get; }
public static Vector2 EditorScreenPointOffset { get; }
public static bool IsBoldLabel { get; set; }
public static bool IsDrawingDictionaryKey { get; }
public static Vector2 MouseScreenPosition { get; }
public static void BeginDrawToNothing()
public static void BeginIgnoreInput()
public static void BeginLayoutMeasuring()
public static void BeginLayoutMeasuring(out int cursor)
System.Int32 | cursor |
public static float CalcHeight(this GUIStyle style, string text, float width)
UnityEngine.GUIStyle | style | The UnityEngine.GUIStyle to present the System.String as. |
System.String | text | The System.String to measure. |
System.Single | width | The width of the area the System.String is being presented in. |
System.Single | The height of the System.String. |
public static void CalcMinMaxWidth(this GUIStyle style, string text, out float minWidth, out float maxWidth)
UnityEngine.GUIStyle | style | The UnityEngine.GUIStyle to present the System.String as. |
System.String | text | The System.String to measure. |
System.Single | minWidth | The minimum width of the System.String. |
System.Single | maxWidth | The maximum width of the System.String. |
public static Vector2 CalcSize(this GUIStyle style, string text)
UnityEngine.GUIStyle | style | The UnityEngine.GUIStyle to present the System.String as. |
System.String | text | The System.String to measure. |
UnityEngine.Vector2 | A UnityEngine.Vector2 consisting of the width (UnityEngine.Vector2.x) & height (UnityEngine.Vector2.y), as the size of the System.String in GUI-space. |
public static float CalcWidth(this GUIStyle style, string text)
UnityEngine.GUIStyle | style | The UnityEngine.GUIStyle to present the System.String as. |
System.String | text | The System.String to measure. |
System.Single | The width of the System.String. |
public static float CalcWidth(this GUIStyle style, GUIContent content)
UnityEngine.GUIStyle | style | The UnityEngine.GUIStyle to present the UnityEngine.GUIContent as. |
UnityEngine.GUIContent | content | The UnityEngine.GUIContent to measure. |
System.Single | The width of the UnityEngine.GUIContent. |
public static void ClearRepaintRequest()
public static bool DisplaySmartUpdatingCancellableProgressBar(string title, string details, float progress, int updateIntervalByMS = 150)
System.String | title | |
System.String | details | |
System.Single | progress | |
System.Int32 | updateIntervalByMS |
System.Boolean |
public static bool DisplaySmartUpdatingCancellableProgressBar(string title, string details, float progress, int updateIntervalByMS, int updateIntervalByCall = 50)
System.String | title | |
System.String | details | |
System.Single | progress | |
System.Int32 | updateIntervalByMS | |
System.Int32 | updateIntervalByCall |
System.Boolean |
public static void DisplaySmartUpdatingProgressBar(string title, string details, float progress, int updateIntervalByMS = 200, int updateIntervalByCall = 50)
System.String | title | |
System.String | details | |
System.Single | progress | |
System.Int32 | updateIntervalByMS | |
System.Int32 | updateIntervalByCall |
public static void DrawLastControlId(string name = null, int lineNumber = 0)
System.String | name | |
System.Int32 | lineNumber |
public static void EndDrawToNothing()
public static void EndIgnoreInput()
public static Rect EndLayoutMeasuring()
UnityEngine.Rect | The measured rect. |
public static Rect EndLayoutMeasuring(int cursor)
System.Int32 | cursor |
UnityEngine.Rect | The measured rect. |
public static void ExitGUI(bool removeFocusControl)
System.Boolean | removeFocusControl |
public static Texture2D GetAssetThumbnail(Object obj, Type type, bool preferObjectPreviewOverFileIcon)
UnityEngine.Object | obj | |
System.Type | type | |
System.Boolean | preferObjectPreviewOverFileIcon |
UnityEngine.Texture2D |
public static bool GetBoldDefaultFont()
System.Boolean |
public static Rect GetCurrentLayoutRect()
UnityEngine.Rect | The current layout rect. |
public static GUIStyle GetCurrentLayoutStyle()
UnityEngine.GUIStyle | The current layout rect. |
public static Rect GetEditorWindowRect()
UnityEngine.Rect |
public static Color GetPlaymodeTint()
UnityEngine.Color | The playmode color tint. |
public static Texture GetPreviewTexture(Object objectToPreview)
UnityEngine.Object | objectToPreview |
UnityEngine.Texture |
System.ArgumentNullException |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object key)
where TValue : class, new()
System.Object | key | The key for the context. |
GUIContext<TValue> | GUIConfig for the specified key. |
TValue | The type of the value. |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object key, TValue defaultValue)
where TValue : struct
System.Object | key | Key for the context. |
TValue | defaultValue | Default value of the context. |
GUIContext<TValue> |
TValue |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object key, int id)
where TValue : class, new()
System.Object | key | The key for the config. |
System.Int32 | id | The ID for the config. |
GUIContext<TValue> | GUIConfig for the specified key and ID. |
TValue | The type of the value. |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object key, int id, TValue defaultValue)
where TValue : struct
System.Object | key | Key for the context. |
System.Int32 | id | Id for the context. |
TValue | defaultValue | Default value of the context. |
GUIContext<TValue> |
TValue |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object primaryKey, object secondaryKey)
where TValue : class, new()
System.Object | primaryKey | The primary key. |
System.Object | secondaryKey | The secondary key. |
GUIContext<TValue> | GUIConfig for the specified primary and secondary key. |
TValue | The type of the value. |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object primaryKey, object secondaryKey, TValue defaultValue)
where TValue : struct
System.Object | primaryKey | Primary key for the context. |
System.Object | secondaryKey | Secondary key for the context. |
TValue | defaultValue | Default value of the context. |
GUIContext<TValue> |
TValue |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object key, string name)
where TValue : class, new()
System.Object | key | The key for the config. |
System.String | name | The name of the config. |
GUIContext<TValue> | GUIConfig for the specified key and name. |
TValue | The type of the config value. |
public static GUIContext<TValue> GetTemporaryContext<TValue>(object key, string name, TValue defaultValue)
where TValue : struct
System.Object | key | Key for the context. |
System.String | name | Name for the context. |
TValue | defaultValue | Default value of the context. |
GUIContext<TValue> |
TValue |
public static GUIContext<TValue> GetTemporaryNullableContext<TValue>(object key)
where TValue : class
System.Object | key | Key for the context. |
GUIContext<TValue> |
TValue |
public static GUIContext<TValue> GetTemporaryNullableContext<TValue>(object key, int id)
where TValue : class
System.Object | key | Key for context. |
System.Int32 | id | Id of the context. |
GUIContext<TValue> |
TValue |
public static GUIContext<TValue> GetTemporaryNullableContext<TValue>(object primaryKey, object secondaryKey)
where TValue : class
System.Object | primaryKey | Primary key for the context. |
System.Object | secondaryKey | Secondary key for the context. |
GUIContext<TValue> |
TValue |
public static GUIContext<TValue> GetTemporaryNullableContext<TValue>(object key, string name)
where TValue : class
System.Object | key | Key for context. |
System.String | name | Name for the context. |
GUIContext<TValue> |
TValue |
public static Rect IndentRect(Rect rect)
UnityEngine.Rect | rect | The rect to indent. |
UnityEngine.Rect | Indented rect. |
public static void IndentRect(ref Rect rect)
UnityEngine.Rect | rect | The rect to indent. |
public static bool IsDockedWindow(EditorWindow window)
UnityEditor.EditorWindow | window | The editor window. |
System.Boolean |
|
public static void OpenInspectorWindow(Object unityObj)
UnityEngine.Object | unityObj | The unity object. |
System.ArgumentNullException | unityObj |
public static void PingObject(Object obj)
UnityEngine.Object | obj |
public static void PopColor()
public static void PopContentColor()
public static void PopContextWidth()
public static void PopEventType()
public static void PopFadeGroupDuration()
public static void PopGUIEnabled()
public static void PopGUIPositionOffset()
public static void PopHierarchyMode()
public static void PopIndentLevel()
public static void PopIsBoldLabel()
public static void PopIsDrawingDictionaryKey()
public static void PopLabelColor()
public static void PopLabelWidth()
public static void PopMatrix()
public static void PopResponsiveVectorComponentFields()
public static void PopTabPageSlideAnimationDuration()
public static void PushColor(Color color, bool blendAlpha = false)
UnityEngine.Color | color | The color to push the GUI color.. |
System.Boolean | blendAlpha | if set to |
public static void PushContentColor(Color color, bool blendAlpha = false)
UnityEngine.Color | color | The content color to push.. |
System.Boolean | blendAlpha | If set to |
public static void PushContextWidth(float width)
System.Single | width | The width to push. |
public static void PushEventType(EventType eventType)
UnityEngine.EventType | eventType | The type of event to push. |
public static void PushFadeGroupDuration(float duration)
System.Single | duration |
public static void PushGUIEnabled(bool enabled)
System.Boolean | enabled | If set to |
public static void PushGUIPositionOffset(Vector2 offset)
UnityEngine.Vector2 | offset | The GUI offset. |
public static void PushHierarchyMode(bool hierarchyMode, bool preserveCurrentLabelWidth = true)
System.Boolean | hierarchyMode | The hierachy mode state to push. |
System.Boolean | preserveCurrentLabelWidth | Changing hierachy mode also changes how label-widths are calcualted. By default, we try to keep the current label width. |
public static void PushIndentLevel(int indentLevel)
System.Int32 | indentLevel | The indent level to push. |
public static void PushIsBoldLabel(bool isBold)
System.Boolean | isBold | Value indicating if labels should be bold or not. |
public static void PushIsDrawingDictionaryKey(bool enabled)
System.Boolean | enabled |
public static void PushLabelColor(Color color)
UnityEngine.Color | color | The label color to push. |
public static void PushLabelWidth(float labelWidth)
System.Single | labelWidth | The editor GUI label width to push. |
public static void PushMatrix(Matrix4x4 matrix)
UnityEngine.Matrix4x4 | matrix | The GUI matrix to push. |
public static void PushResponsiveVectorComponentFields(bool responsive)
System.Boolean | responsive |
public static void PushTabPageSlideAnimationDuration(float duration)
System.Single | duration |
public static void RemoveFocusControl()
public static void RepaintIfRequested(this Editor editor)
UnityEditor.Editor | editor | The editor to repaint. |
public static void RepaintIfRequested(this EditorWindow window)
UnityEditor.EditorWindow | window | The window to repaint. |
public static void RequestRepaint()
public static void SafeHandleUtilityRepaint()
public static void SelectObject(Object obj)
UnityEngine.Object | obj |
public static bool ShouldDisplaySmartCancellableProgressBar(int updateIntervalByMS = 150)
System.Int32 | updateIntervalByMS |
System.Boolean |
public static RenderTexture TakeGUIScreenshot(Rect rect)
UnityEngine.Rect | rect | The rect. |
UnityEngine.RenderTexture | The screenshot as a render texture. |
public static GUIContent TempContent(string t)
System.String | t | The text for the GUIContent. |
UnityEngine.GUIContent | Temporary GUIContent instance. |
public static GUIContent TempContent(string t, string tooltip)
System.String | t | The text for the GUIContent. |
System.String | tooltip | The tooltip for the GUIContent. |
UnityEngine.GUIContent | Temporary GUIContent instance. |
public static GUIContent TempContent(string text, Texture image, string tooltip = null)
System.String | text | The text for the GUIContent. |
UnityEngine.Texture | image | The image for the GUIContent. |
System.String | tooltip | The tooltip for the GUIContent. |
UnityEngine.GUIContent | Temporary GUIContent instance. |
public static GUIContent TempContent(Texture image, string tooltip = null)
UnityEngine.Texture | image | The image for the GUIContent. |
System.String | tooltip | The tooltip for the GUIContent. |
UnityEngine.GUIContent | Temporary GUIContent instance. |