docs.unity3d.com
    Show / Hide Table of Contents

    Method SetComponentForEntityQuery

    SetComponentForEntityQuery<T>(EntityCommandBuffer, EntityQuery, T)

    Records a command to set a managed component value for all entities matching a query.

    Declaration
    public static void SetComponentForEntityQuery<T>(this EntityCommandBuffer ecb, EntityQuery query, T component)
        where T : class, IComponentData
    Parameters
    Type Name Description
    EntityCommandBuffer ecb
    EntityQuery query

    The query specifying which entities to set the component value for.

    T component

    The component value to set.

    Type Parameters
    Name Description
    T
    Remarks

    The set of entities matching the query is 'captured' in the method call, and the recorded command stores an array of all these entities.

    If any entity does not have the component type at playback , playback Entities which already have the component type will have the component set to the value.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown in playback if one or more of the entities does not have the component type or has been destroyed. (With safety checks disabled, playback will perform invalid and unsafe memory access.).

    NullReferenceException

    Throws if an Allocator was not passed in when the EntityCommandBuffer was created.

    InvalidOperationException

    Throws if this EntityCommandBuffer has already been played back.

    Back to top
    Terms of use
    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