docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetComponent

    SetComponent(TComponent)

    Set a component to the value specified.

    Declaration
    public void SetComponent(TComponent value)
    Parameters
    Type Name Description
    TComponent value

    The component value.

    SetComponent<T>(T)

    Set a component to the value specified.

    Declaration
    public void SetComponent<T>(T value) where T : TComponent
    Parameters
    Type Name Description
    T value

    The component value.

    Type Parameters
    Name Description
    T

    The component type.

    SetComponent(Type)

    Set a component to default value.

    Declaration
    public void SetComponent(Type componentType)
    Parameters
    Type Name Description
    Type componentType

    The component type.

    SetComponent<T>()

    Set a component to default value.

    Declaration
    public void SetComponent<T>() where T : TComponent
    Type Parameters
    Name Description
    T

    The component type.

    SetComponent(Type, TComponent)

    Declaration
    [Obsolete("The separate component type parameter is no longer required, please remove it. (RemovedAfter 2021-01-01)")]
    public void SetComponent(Type componentType, TComponent value)
    Parameters
    Type Name Description
    Type componentType
    TComponent value
    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)