docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TypeUtility

    Inheritance
    object
    TypeUtility
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.VisualScripting
    Assembly: Unity.VisualScripting.Core.dll
    Syntax
    public static class TypeUtility

    Methods

    AndBaseTypeAndInterfaces(Type)

    Declaration
    public static IEnumerable<Type> AndBaseTypeAndInterfaces(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    AndHierarchy(Type)

    Declaration
    public static IEnumerable<Type> AndHierarchy(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    AndInterfaces(Type)

    Declaration
    public static IEnumerable<Type> AndInterfaces(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    BaseTypeAndInterfaces(Type, bool)

    Declaration
    public static IEnumerable<Type> BaseTypeAndInterfaces(this Type type, bool inheritedInterfaces = true)
    Parameters
    Type Name Description
    Type type
    bool inheritedInterfaces
    Returns
    Type Description
    IEnumerable<Type>

    CanMakeGenericTypeVia(Type, Type)

    Declaration
    public static bool CanMakeGenericTypeVia(this Type openConstructedType, Type closedConstructedType)
    Parameters
    Type Name Description
    Type openConstructedType
    Type closedConstructedType
    Returns
    Type Description
    bool

    Default(Type)

    Declaration
    public static object Default(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    object

    GetDictionaryItemType(Type, bool, int)

    Declaration
    public static Type GetDictionaryItemType(Type dictionaryType, bool allowNonGeneric, int genericArgumentIndex)
    Parameters
    Type Name Description
    Type dictionaryType
    bool allowNonGeneric
    int genericArgumentIndex
    Returns
    Type Description
    Type

    GetDictionaryKeyType(Type, bool)

    Declaration
    public static Type GetDictionaryKeyType(Type dictionaryType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type dictionaryType
    bool allowNonGeneric
    Returns
    Type Description
    Type

    GetDictionaryValueType(Type, bool)

    Declaration
    public static Type GetDictionaryValueType(Type dictionaryType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type dictionaryType
    bool allowNonGeneric
    Returns
    Type Description
    Type

    GetEnumerableElementType(Type, bool)

    Declaration
    public static Type GetEnumerableElementType(Type enumerableType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type enumerableType
    bool allowNonGeneric
    Returns
    Type Description
    Type

    GetInterfaces(Type, bool)

    Declaration
    public static IEnumerable<Type> GetInterfaces(this Type type, bool includeInherited)
    Parameters
    Type Name Description
    Type type
    bool includeInherited
    Returns
    Type Description
    IEnumerable<Type>

    GetListElementType(Type, bool)

    Declaration
    public static Type GetListElementType(Type listType, bool allowNonGeneric)
    Parameters
    Type Name Description
    Type listType
    bool allowNonGeneric
    Returns
    Type Description
    Type

    GetTypesSafely(Assembly)

    Declaration
    public static IEnumerable<Type> GetTypesSafely(this Assembly assembly)
    Parameters
    Type Name Description
    Assembly assembly
    Returns
    Type Description
    IEnumerable<Type>

    Hierarchy(Type)

    Declaration
    public static IEnumerable<Type> Hierarchy(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    IEnumerable<Type>

    Instantiate(Type, bool, params object[])

    Declaration
    public static object Instantiate(this Type type, bool nonPublic = true, params object[] args)
    Parameters
    Type Name Description
    Type type
    bool nonPublic
    object[] args
    Returns
    Type Description
    object

    Instantiator(Type, bool)

    Declaration
    public static Func<object> Instantiator(this Type type, bool nonPublic = true)
    Parameters
    Type Name Description
    Type type
    bool nonPublic
    Returns
    Type Description
    Func<object>

    Instantiator(Type, bool, params Type[])

    Declaration
    public static Func<object[], object> Instantiator(this Type type, bool nonPublic = true, params Type[] parameterTypes)
    Parameters
    Type Name Description
    Type type
    bool nonPublic
    Type[] parameterTypes
    Returns
    Type Description
    Func<object[], object>

    IsAbstract(Type)

    Declaration
    public static bool IsAbstract(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsAssignableFrom(Type, object)

    Declaration
    public static bool IsAssignableFrom(this Type type, object value)
    Parameters
    Type Name Description
    Type type
    object value
    Returns
    Type Description
    bool

    IsBasic(Type)

    Declaration
    public static bool IsBasic(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsConcrete(Type)

    Declaration
    public static bool IsConcrete(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsNullable(Type)

    Declaration
    public static bool IsNullable(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsNumeric(Type)

    Declaration
    public static bool IsNumeric(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsNumericConstruct(Type)

    Declaration
    public static bool IsNumericConstruct(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsReferenceType(Type)

    Declaration
    public static bool IsReferenceType(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsStatic(Type)

    Declaration
    public static bool IsStatic(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    IsStruct(Type)

    Declaration
    public static bool IsStruct(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    bool

    MakeGenericTypeVia(Type, Type, Dictionary<Type, Type>, bool)

    Declaration
    public static Type MakeGenericTypeVia(this Type openConstructedType, Type closedConstructedType, Dictionary<Type, Type> resolvedGenericParameters, bool safe = true)
    Parameters
    Type Name Description
    Type openConstructedType
    Type closedConstructedType
    Dictionary<Type, Type> resolvedGenericParameters
    bool safe
    Returns
    Type Description
    Type

    Namespace(Type)

    Declaration
    public static Namespace Namespace(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    Namespace

    PseudoDefault(Type)

    Declaration
    public static object PseudoDefault(this Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    object

    ToShortString(object, int)

    Declaration
    public static string ToShortString(this object o, int maxLength = 20)
    Parameters
    Type Name Description
    object o
    int maxLength
    Returns
    Type Description
    string

    TryInstantiate(Type, bool, params object[])

    Declaration
    public static object TryInstantiate(this Type type, bool nonPublic = true, params object[] args)
    Parameters
    Type Name Description
    Type type
    bool nonPublic
    object[] args
    Returns
    Type Description
    object

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Methods
      • AndBaseTypeAndInterfaces(Type)
      • AndHierarchy(Type)
      • AndInterfaces(Type)
      • BaseTypeAndInterfaces(Type, bool)
      • CanMakeGenericTypeVia(Type, Type)
      • Default(Type)
      • GetDictionaryItemType(Type, bool, int)
      • GetDictionaryKeyType(Type, bool)
      • GetDictionaryValueType(Type, bool)
      • GetEnumerableElementType(Type, bool)
      • GetInterfaces(Type, bool)
      • GetListElementType(Type, bool)
      • GetTypesSafely(Assembly)
      • Hierarchy(Type)
      • Instantiate(Type, bool, params object[])
      • Instantiator(Type, bool)
      • Instantiator(Type, bool, params Type[])
      • IsAbstract(Type)
      • IsAssignableFrom(Type, object)
      • IsBasic(Type)
      • IsConcrete(Type)
      • IsNullable(Type)
      • IsNumeric(Type)
      • IsNumericConstruct(Type)
      • IsReferenceType(Type)
      • IsStatic(Type)
      • IsStruct(Type)
      • MakeGenericTypeVia(Type, Type, Dictionary<Type, Type>, bool)
      • Namespace(Type)
      • PseudoDefault(Type)
      • ToShortString(object, int)
      • TryInstantiate(Type, bool, params object[])
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)