docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Method GetAttribute

    GetAttribute<TAttribute>(Type, bool)

    Gets the first attribute of a given type.

    Declaration
    public static TAttribute GetAttribute<TAttribute>(this Type type, bool inherit = false) where TAttribute : Attribute
    Parameters
    Type Name Description
    Type type

    The type whose attribute will be returned.

    bool inherit

    Whether to search this type's inheritance chain to find the attribute.

    Returns
    Type Description
    TAttribute

    The first TAttribute found.

    Type Parameters
    Name Description
    TAttribute

    Attribute type to return.

    In This Article
    Back to top
    Copyright © 2024 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)