docs.unity3d.com
    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 © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023