docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method TryGetComponent

    TryGetComponent(Type, out TComponent)

    Get a component value.

    Declaration
    public bool TryGetComponent(Type type, out TComponent value)
    Parameters
    Type Name Description
    Type type
    TComponent value

    The component value.

    Returns
    Type Description
    bool

    true if the component is found, false otherwise.

    TryGetComponent<T>(out T)

    Get a component value.

    Declaration
    public bool TryGetComponent<T>(out T value) where T : TComponent
    Parameters
    Type Name Description
    T value

    The component value.

    Returns
    Type Description
    bool

    true if the component is found, false 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)