Class EditorUtils | Unity Reflect | 1.0.0-preview.11
docs.unity3d.com
    Show / Hide Table of Contents

    Class EditorUtils

    Inheritance
    Object
    EditorUtils
    Namespace: Unity.Labs.Utils
    Syntax
    public static class EditorUtils

    Methods

    ConsumeMouseInput()

    Consumes mouse input events. Call this at the end of a GUI window draw function to block clicking on controls behind the window.

    Declaration
    public static void ConsumeMouseInput()

    GetActiveSceneAsset()

    Get the SceneAsset representing the active scene

    Declaration
    public static SceneAsset GetActiveSceneAsset()
    Returns
    Type Description
    SceneAsset

    The active SceneAsset

    GetAssetPreview(Object, Action<Texture>)

    Tries to get an asset preview. If one is not available, waits until IsLoadingAssetPreview is false, and if preview is still not loaded, returns the result of AssetPreview.GetMiniThumbnail

    Declaration
    public static IEnumerator GetAssetPreview(Object asset, Action<Texture> callback)
    Parameters
    Type Name Description
    UnityEngine.Object asset

    The asset for which to get a preview

    Action<Texture> callback

    Called with the preview texture as an argument, when it is available

    Returns
    Type Description
    IEnumerator

    An enumerator used to tick the corutine

    GetFieldInfoFromProperty(SerializedProperty)

    Declaration
    public static FieldInfo GetFieldInfoFromProperty(SerializedProperty property)
    Parameters
    Type Name Description
    SerializedProperty property
    Returns
    Type Description
    FieldInfo

    GetMemberAttributes(SerializedProperty)

    Declaration
    public static Attribute[] GetMemberAttributes(SerializedProperty property)
    Parameters
    Type Name Description
    SerializedProperty property
    Returns
    Type Description
    Attribute[]

    GetMemberInfoFromPropertyPath(Type, String, out Type)

    Declaration
    public static MemberInfo GetMemberInfoFromPropertyPath(Type host, string path, out Type type)
    Parameters
    Type Name Description
    Type host
    String path
    Type type
    Returns
    Type Description
    MemberInfo

    GetTooltip(SerializedProperty)

    Gets the tooltip of the property. This is a workaround for a bug where SerializedProperty.tooltip always returns an empty string: https://issuetracker.unity3d.com/issues/when-using-custom-propertydrawers-the-tooltip-field-of-the-serializedproperty-is-always-empty

    Declaration
    public static string GetTooltip(this SerializedProperty property)
    Parameters
    Type Name Description
    SerializedProperty property
    Returns
    Type Description
    String

    Tooltip specified in the property's TooltipAttribute, if it has one. Otherwise returns an empty string.

    MaskField(Rect, GUIContent, Int32, String[], Type)

    Special version of EditorGUI.MaskField which ensures that only the chosen bits are set. We need this version of the function to check explicitly whether only a single bit was set.

    Declaration
    public static int MaskField(Rect position, GUIContent label, int mask, string[] displayedOptions, Type propertyType)
    Parameters
    Type Name Description
    Rect position
    GUIContent label
    Int32 mask
    String[] displayedOptions
    Type propertyType
    Returns
    Type Description
    Int32

    NicifySerializedPropertyType(String)

    Declaration
    public static string NicifySerializedPropertyType(string type)
    Parameters
    Type Name Description
    String type
    Returns
    Type Description
    String

    SerializedPropertyToField(SerializedProperty)

    Declaration
    public static FieldInfo SerializedPropertyToField(SerializedProperty property)
    Parameters
    Type Name Description
    SerializedProperty property
    Returns
    Type Description
    FieldInfo

    SerializedPropertyToType(SerializedProperty)

    Guess the type of a SerializedProperty and return a System.Type, if one exists. The guess is done by checking the type of the target object and iterating through its fields looking for one that matches the property name. This may return null if you give it a SerializedProperty that represents a native type with no managed equivalent

    Declaration
    public static Type SerializedPropertyToType(SerializedProperty property)
    Parameters
    Type Name Description
    SerializedProperty property

    The SerializedProperty to examine

    Returns
    Type Description
    Type

    The best guess type

    ToggleClassIcons(Dictionary<Int32, KeyValuePair<String, Boolean>>)

    Declaration
    public static void ToggleClassIcons(Dictionary<int, KeyValuePair<string, bool>> enabledStates)
    Parameters
    Type Name Description
    Dictionary<Int32, KeyValuePair<String, Boolean>> enabledStates

    ToggleCommonIcons(Boolean, Dictionary<Int32, KeyValuePair<String, Boolean>>)

    Declaration
    public static void ToggleCommonIcons(bool enabled, Dictionary<int, KeyValuePair<string, bool>> classIconEnabledStates)
    Parameters
    Type Name Description
    Boolean enabled
    Dictionary<Int32, KeyValuePair<String, Boolean>> classIconEnabledStates

    TypeNameToType(String)

    Search through all assemblies in the current AppDomain for a class that is assignable to UnityObject and matches the given weak name TODO: expose internal SerializedProperty.ValidateObjectReferenceValue to remove his hack

    Declaration
    public static Type TypeNameToType(string name)
    Parameters
    Type Name Description
    String name

    Weak type name

    Returns
    Type Description
    Type

    Best guess System.Type

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023