docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetComponent

    GetComponent(Type)

    Get a component value.

    Declaration
    public TComponent GetComponent(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type Description
    TComponent

    The component value if found, throws otherwise.

    GetComponent<T>()

    Get a component value.

    Declaration
    public T GetComponent<T>() where T : TComponent
    Returns
    Type Description
    T

    The component value if found, throws otherwise.

    Type Parameters
    Name Description
    T

    The component type.

    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)