docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetComponentOrDefault

    GetComponentOrDefault(Type)

    Get a component value if found, default value otherwise.

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

    The component value if found, default value otherwise.

    GetComponentOrDefault<T>()

    Get a component value if found, default value otherwise.

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

    The component value if found, default value otherwise.

    Type Parameters
    Name Description
    T
    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)