mrtk_developmentreleases/2.0.0releases/2.1.0releases/2.2.0releases/2.3.0releases/2.4.0releases/2.5.0releases/2.5.1releases/2.5.2releases/2.5.3

We've moved!

Starting from MRTK 2.6, we are publishing both conceptual docs and API references on docs.microsoft.com. For conceptual docs, please visit our new landing page. For API references, please visit the MRTK-Unity section of the dot net API explorer. Existing content will remain here but will not be updated further.

Search Results for

    Show / Hide Table of Contents

    Class InspectorUIUtility

    This class has handy inspector UI utilities and functions.

    Inheritance
    Object
    InspectorUIUtility
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.MixedReality.Toolkit.Utilities.Editor
    Assembly: cs.temp.dll.dll
    Syntax
    public static class InspectorUIUtility

    Fields

    Astrisk

    Declaration
    public static readonly string Astrisk
    Field Value
    Type Description
    String

    Close

    Declaration
    public static readonly string Close
    Field Value
    Type Description
    String

    DefaultFontSize

    Declaration
    public const int DefaultFontSize = 10
    Field Value
    Type Description
    Int32

    DocLinkWidth

    Declaration
    public const float DocLinkWidth = 175F
    Field Value
    Type Description
    Single

    Down

    Declaration
    public static readonly string Down
    Field Value
    Type Description
    String

    Emoji

    Declaration
    public static readonly string Emoji
    Field Value
    Type Description
    String

    HeaderFontSize

    Declaration
    public const int HeaderFontSize = 11
    Field Value
    Type Description
    Int32

    Heart

    Declaration
    public static readonly string Heart
    Field Value
    Type Description
    String

    HelpIcon

    Declaration
    public static readonly Texture HelpIcon
    Field Value
    Type Description
    Texture

    InfoIcon

    Declaration
    public static readonly Texture InfoIcon
    Field Value
    Type Description
    Texture

    Left

    Declaration
    public static readonly string Left
    Field Value
    Type Description
    String

    Minus

    Declaration
    public static readonly string Minus
    Field Value
    Type Description
    String

    Plus

    Declaration
    public static readonly string Plus
    Field Value
    Type Description
    String

    Right

    Declaration
    public static readonly string Right
    Field Value
    Type Description
    String

    Star

    Declaration
    public static readonly string Star
    Field Value
    Type Description
    String

    SuccessIcon

    Declaration
    public static readonly Texture SuccessIcon
    Field Value
    Type Description
    Texture

    TitleFontSize

    Declaration
    public const int TitleFontSize = 14
    Field Value
    Type Description
    Int32

    Up

    Declaration
    public static readonly string Up
    Field Value
    Type Description
    String

    WarningIcon

    Declaration
    public static readonly Texture WarningIcon
    Field Value
    Type Description
    Texture

    Properties

    ColorTint10

    Declaration
    public static Color ColorTint10 { get; }
    Property Value
    Type Description
    Color

    ColorTint100

    Declaration
    public static Color ColorTint100 { get; }
    Property Value
    Type Description
    Color

    ColorTint25

    Declaration
    public static Color ColorTint25 { get; }
    Property Value
    Type Description
    Color

    ColorTint50

    Declaration
    public static Color ColorTint50 { get; }
    Property Value
    Type Description
    Color

    ColorTint75

    Declaration
    public static Color ColorTint75 { get; }
    Property Value
    Type Description
    Color

    Methods

    AdjustListSettings(List<InspectorUIUtility.ListSettings>, Int32)

    adjust list settings as things change

    Declaration
    public static List<InspectorUIUtility.ListSettings> AdjustListSettings(List<InspectorUIUtility.ListSettings> listSettings, int count)
    Parameters
    Type Name Description
    List<InspectorUIUtility.ListSettings> listSettings
    Int32 count
    Returns
    Type Description
    List<InspectorUIUtility.ListSettings>

    Box(Int32)

    Box style with left margin

    Declaration
    public static GUIStyle Box(int margin)
    Parameters
    Type Name Description
    Int32 margin
    Returns
    Type Description
    GUIStyle

    DrawComponentTypeFoldout<T>(GameObject, Boolean, String)

    Draws a foldout enlisting all components (or derived types) of the given type attached to the passed gameobject. Adds a button for adding any of the component (or dervied types) and a follow button to highlight existing attached components.

    Declaration
    public static bool DrawComponentTypeFoldout<T>(GameObject gameObject, bool isExpanded, string typeDescription)
        where T : MonoBehaviour
    Parameters
    Type Name Description
    GameObject gameObject
    Boolean isExpanded
    String typeDescription
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    DrawDivider()

    Create a line across the negative space

    Declaration
    public static void DrawDivider()

    DrawEnumSerializedProperty(Rect, SerializedProperty, GUIContent, Enum)

    Draws a popup UI with PropertyField type features. Displays prefab pending updates

    Declaration
    public static Enum DrawEnumSerializedProperty(Rect position, SerializedProperty prop, GUIContent label, Enum propValue)
    Parameters
    Type Name Description
    Rect position

    position to render the serialized property

    SerializedProperty prop

    serialized property corresponding to Enum

    GUIContent label

    label for property

    Enum propValue

    Current enum value for property

    Returns
    Type Description
    Enum

    New enum value after draw

    DrawEnumSerializedProperty(SerializedProperty, GUIContent, Enum)

    Draws a popup UI with PropertyField type features. Displays prefab pending updates

    Declaration
    public static Enum DrawEnumSerializedProperty(SerializedProperty prop, GUIContent label, Enum propValue)
    Parameters
    Type Name Description
    SerializedProperty prop

    serialized property corresponding to Enum

    GUIContent label

    label for property

    Enum propValue

    Current enum value for property

    Returns
    Type Description
    Enum

    New enum value after draw

    DrawError(String)

    draw a notice with red coloring

    Declaration
    public static void DrawError(string error)
    Parameters
    Type Name Description
    String error

    DrawHeader(String)

    Medium title format

    Declaration
    public static void DrawHeader(string header)
    Parameters
    Type Name Description
    String header

    string content to render

    DrawLabel(String, Int32, Color)

    Draw a basic label

    Declaration
    public static void DrawLabel(string title, int size, Color color)
    Parameters
    Type Name Description
    String title
    Int32 size
    Color color

    DrawNotice(String)

    draw a notice area, normal coloring

    Declaration
    public static void DrawNotice(string notice)
    Parameters
    Type Name Description
    String notice

    DrawScriptableFoldout<T>(SerializedProperty, String, Boolean)

    Draws the contents of a scriptable inline inside a foldout. Depending on if there's an actual scriptable linked, the values will be greyed out or editable in case the scriptable is created inside the serialized object.

    Declaration
    public static bool DrawScriptableFoldout<T>(SerializedProperty scriptable, string description, bool isExpanded)
        where T : ScriptableObject
    Parameters
    Type Name Description
    SerializedProperty scriptable
    String description
    Boolean isExpanded
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    DrawSectionFoldout(String, Boolean, GUIStyle)

    Draws a section start (initiated by the Header attribute)

    Declaration
    public static bool DrawSectionFoldout(string headerName, bool open = true, GUIStyle style = null)
    Parameters
    Type Name Description
    String headerName
    Boolean open
    GUIStyle style
    Returns
    Type Description
    Boolean

    DrawSectionFoldoutWithKey(String, String, GUIStyle, Boolean)

    Draws a section start with header name and save open/close state to given preference key in SessionState

    Declaration
    public static bool DrawSectionFoldoutWithKey(string headerName, string preferenceKey = null, GUIStyle style = null, bool defaultOpen = true)
    Parameters
    Type Name Description
    String headerName
    String preferenceKey
    GUIStyle style
    Boolean defaultOpen
    Returns
    Type Description
    Boolean

    DrawSuccess(String)

    draw a notice with green coloring

    Declaration
    public static void DrawSuccess(string notice)
    Parameters
    Type Name Description
    String notice

    DrawTitle(String)

    Large title format

    Declaration
    public static void DrawTitle(string title)
    Parameters
    Type Name Description
    String title

    DrawWarning(String)

    draw a label with a yellow coloring

    Declaration
    public static void DrawWarning(string warning)
    Parameters
    Type Name Description
    String warning

    FlexButton(GUIContent)

    A button that is as wide as the label

    Declaration
    public static bool FlexButton(GUIContent label)
    Parameters
    Type Name Description
    GUIContent label

    content for button

    Returns
    Type Description
    Boolean

    true if button clicked, false otherwise

    FlexButton(GUIContent, Int32, InspectorUIUtility.ListButtonEvent, SerializedProperty)

    A button that is as wide as the label

    Declaration
    public static bool FlexButton(GUIContent label, int index, InspectorUIUtility.ListButtonEvent callback, SerializedProperty prop = null)
    Parameters
    Type Name Description
    GUIContent label
    Int32 index
    InspectorUIUtility.ListButtonEvent callback
    SerializedProperty prop
    Returns
    Type Description
    Boolean

    FlexButton(GUIContent, Int32[], InspectorUIUtility.MultiListButtonEvent, SerializedProperty)

    A button that is as wide as the label

    Declaration
    public static bool FlexButton(GUIContent label, int[] indexArr, InspectorUIUtility.MultiListButtonEvent callback, SerializedProperty prop = null)
    Parameters
    Type Name Description
    GUIContent label
    Int32[] indexArr
    InspectorUIUtility.MultiListButtonEvent callback
    SerializedProperty prop
    Returns
    Type Description
    Boolean

    true if button clicked, false otherwise

    FullWidthButton(GUIContent, Single, Int32, InspectorUIUtility.ListButtonEvent, SerializedProperty)

    A button that is as wide as the available space

    Declaration
    public static bool FullWidthButton(GUIContent label, float padding, int index, InspectorUIUtility.ListButtonEvent callback, SerializedProperty prop = null)
    Parameters
    Type Name Description
    GUIContent label
    Single padding
    Int32 index
    InspectorUIUtility.ListButtonEvent callback
    SerializedProperty prop
    Returns
    Type Description
    Boolean

    FullWidthButton(GUIContent, Single, Int32[], InspectorUIUtility.MultiListButtonEvent, SerializedProperty)

    A button that is as wide as the available space

    Declaration
    public static bool FullWidthButton(GUIContent label, float padding, int[] indexArr, InspectorUIUtility.MultiListButtonEvent callback, SerializedProperty prop = null)
    Parameters
    Type Name Description
    GUIContent label
    Single padding
    Int32[] indexArr
    InspectorUIUtility.MultiListButtonEvent callback
    SerializedProperty prop
    Returns
    Type Description
    Boolean

    GetOptions(SerializedProperty)

    Get an array of strings from a serialized list of strings, pop-up field helper

    Declaration
    public static string[] GetOptions(SerializedProperty options)
    Parameters
    Type Name Description
    SerializedProperty options
    Returns
    Type Description
    String[]

    GetOptionsIndex(SerializedProperty, String)

    Get the index of a serialized array item based on its name, pop-up field helper

    Declaration
    public static int GetOptionsIndex(SerializedProperty options, string selection)
    Parameters
    Type Name Description
    SerializedProperty options
    String selection
    Returns
    Type Description
    Int32

    HelpBox(Int32)

    Help box style with left margin

    Declaration
    public static GUIStyle HelpBox(int margin)
    Parameters
    Type Name Description
    Int32 margin

    amount of left margin

    Returns
    Type Description
    GUIStyle

    Configured helpbox GUIStyle

    LableStyle(Int32, Color)

    Create a custom label style based on color and size

    Declaration
    public static GUIStyle LableStyle(int size, Color color)
    Parameters
    Type Name Description
    Int32 size
    Color color
    Returns
    Type Description
    GUIStyle

    RenderDocumentationButton(String, Single)

    Render documentation button routing to relevant URI

    Declaration
    public static bool RenderDocumentationButton(string docURL, float width = 175F)
    Parameters
    Type Name Description
    String docURL

    documentation URL to open on button click

    Single width
    Returns
    Type Description
    Boolean

    true if button clicked, false otherwise

    RenderDocumentationSection(String)

    Render a documentation header with button for given url value

    Declaration
    public static bool RenderDocumentationSection(string url)
    Parameters
    Type Name Description
    String url

    Url to open if button is clicked

    Returns
    Type Description
    Boolean

    true if object drawn and button clicked, false otherwise

    RenderHelpURL(Type)

    Render a documentation header with button if Object contains HelpURLAttribute

    Declaration
    public static bool RenderHelpURL(Type targetType)
    Parameters
    Type Name Description
    Type targetType

    Type to test for HelpURLAttribute

    Returns
    Type Description
    Boolean

    true if object drawn and button clicked, false otherwise

    RenderIndentedButton(GUIContent, GUIStyle, GUILayoutOption[])

    Helper function to render buttons correctly indented according to EditorGUI.indentLevel since GUILayout component don't respond naturally

    Declaration
    public static bool RenderIndentedButton(GUIContent content, GUIStyle style, params GUILayoutOption[] options)
    Parameters
    Type Name Description
    GUIContent content

    What to draw in button

    GUIStyle style

    Style configuration for button

    GUILayoutOption[] options

    layout options

    Returns
    Type Description
    Boolean

    true if button clicked, false if otherwise

    RenderIndentedButton(Func<Boolean>)

    Helper function to support primary overloaded version of this functionality

    Declaration
    public static bool RenderIndentedButton(Func<bool> renderButton)
    Parameters
    Type Name Description
    Func<Boolean> renderButton

    The code to render button correctly based on parameter types passed

    Returns
    Type Description
    Boolean

    true if button clicked, false if otherwise

    RenderIndentedButton(String, GUILayoutOption[])

    Helper function to render buttons correctly indented according to EditorGUI.indentLevel since GUILayout component don't respond naturally

    Declaration
    public static bool RenderIndentedButton(string buttonText, params GUILayoutOption[] options)
    Parameters
    Type Name Description
    String buttonText

    text to place in button

    GUILayoutOption[] options

    layout options

    Returns
    Type Description
    Boolean

    true if button clicked, false if otherwise

    SmallButton(GUIContent)

    A small button, good for a single icon like + or -

    Declaration
    public static bool SmallButton(GUIContent label)
    Parameters
    Type Name Description
    GUIContent label

    content to place in the button

    Returns
    Type Description
    Boolean

    true if button selected, false otherwise

    SmallButton(GUIContent, Int32, InspectorUIUtility.ListButtonEvent, SerializedProperty)

    A small button, good for a single icon like + or - with single index callback events

    Declaration
    public static bool SmallButton(GUIContent label, int index, InspectorUIUtility.ListButtonEvent callback, SerializedProperty prop = null)
    Parameters
    Type Name Description
    GUIContent label

    content to place in the button

    Int32 index
    InspectorUIUtility.ListButtonEvent callback
    SerializedProperty prop
    Returns
    Type Description
    Boolean

    true if button selected, false otherwise

    SmallButton(GUIContent, Int32[], InspectorUIUtility.MultiListButtonEvent, SerializedProperty)

    A small button, good for a single icon like + or - with multi-index callback events

    Declaration
    public static bool SmallButton(GUIContent label, int[] indexArr, InspectorUIUtility.MultiListButtonEvent callback, SerializedProperty prop = null)
    Parameters
    Type Name Description
    GUIContent label

    content to place in the button

    Int32[] indexArr
    InspectorUIUtility.MultiListButtonEvent callback
    SerializedProperty prop
    Returns
    Type Description
    Boolean

    true if button selected, false otherwise

    In This Article
    • Fields
      • Astrisk
      • Close
      • DefaultFontSize
      • DocLinkWidth
      • Down
      • Emoji
      • HeaderFontSize
      • Heart
      • HelpIcon
      • InfoIcon
      • Left
      • Minus
      • Plus
      • Right
      • Star
      • SuccessIcon
      • TitleFontSize
      • Up
      • WarningIcon
    • Properties
      • ColorTint10
      • ColorTint100
      • ColorTint25
      • ColorTint50
      • ColorTint75
    • Methods
      • AdjustListSettings(List<InspectorUIUtility.ListSettings>, Int32)
      • Box(Int32)
      • DrawComponentTypeFoldout<T>(GameObject, Boolean, String)
      • DrawDivider()
      • DrawEnumSerializedProperty(Rect, SerializedProperty, GUIContent, Enum)
      • DrawEnumSerializedProperty(SerializedProperty, GUIContent, Enum)
      • DrawError(String)
      • DrawHeader(String)
      • DrawLabel(String, Int32, Color)
      • DrawNotice(String)
      • DrawScriptableFoldout<T>(SerializedProperty, String, Boolean)
      • DrawSectionFoldout(String, Boolean, GUIStyle)
      • DrawSectionFoldoutWithKey(String, String, GUIStyle, Boolean)
      • DrawSuccess(String)
      • DrawTitle(String)
      • DrawWarning(String)
      • FlexButton(GUIContent)
      • FlexButton(GUIContent, Int32, InspectorUIUtility.ListButtonEvent, SerializedProperty)
      • FlexButton(GUIContent, Int32[], InspectorUIUtility.MultiListButtonEvent, SerializedProperty)
      • FullWidthButton(GUIContent, Single, Int32, InspectorUIUtility.ListButtonEvent, SerializedProperty)
      • FullWidthButton(GUIContent, Single, Int32[], InspectorUIUtility.MultiListButtonEvent, SerializedProperty)
      • GetOptions(SerializedProperty)
      • GetOptionsIndex(SerializedProperty, String)
      • HelpBox(Int32)
      • LableStyle(Int32, Color)
      • RenderDocumentationButton(String, Single)
      • RenderDocumentationSection(String)
      • RenderHelpURL(Type)
      • RenderIndentedButton(GUIContent, GUIStyle, GUILayoutOption[])
      • RenderIndentedButton(Func<Boolean>)
      • RenderIndentedButton(String, GUILayoutOption[])
      • SmallButton(GUIContent)
      • SmallButton(GUIContent, Int32, InspectorUIUtility.ListButtonEvent, SerializedProperty)
      • SmallButton(GUIContent, Int32[], InspectorUIUtility.MultiListButtonEvent, SerializedProperty)
    Back to top Generated by DocFX