docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetComponent

    SetComponent(Type, TComponent)

    Set the value of a Type component on this container.

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

    Type of the component.

    TComponent value

    Value of the component to set.

    SetComponent<T>(T)

    Set the value of a T component on this container.

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

    Value of the component to set.

    Type Parameters
    Name Description
    T

    Type of the component.

    SetComponent(Type)

    Set the value of a Type component on this container using an instance created using TypeConstruction utility.

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

    Type of the component.

    SetComponent<T>()

    Set the value of a T component on this container using an instance created using TypeConstruction utility.

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

    Type of the component.

    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)