docs.unity.cn
    Show / Hide Table of Contents

    Method AddSharedComponent

    AddSharedComponent<T>(Entity, T)

    Declaration
    public void AddSharedComponent<T>(Entity e, T component)
        where T : struct, ISharedComponentData
    Parameters
    Type Name Description
    Entity e
    T component
    Type Parameters
    Name Description
    T

    AddSharedComponent<T>(EntityQuery, T)

    Records a command to add a shared component to all entities matching a query.

    Declaration
    public void AddSharedComponent<T>(EntityQuery entityQuery, T component)
        where T : struct, ISharedComponentData
    Parameters
    Type Name Description
    EntityQuery entityQuery

    The query specifying which entities to add the component value to.

    T component

    The component value to add.

    Type Parameters
    Name Description
    T
    Remarks

    The query is performed at playback time, not when the method is called. For entities matching the query which already have this component type, the value is updated.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on Friday, May 28, 2021