docs.unity.cn
    Show / Hide Table of Contents

    Method AddComponentData

    AddComponentData<T>(ForEachLambdaJobDescription, NativeArray<T>)

    Adds a component to a set of entities selected by the query you have defined using WithAny/WithAll/WithNone and sets the component of each entity in the query to the value in the component array.

    Declaration
    public static void AddComponentData<T>(this ForEachLambdaJobDescription description, NativeArray<T> componentArray)
        where T : struct, IComponentData
    Parameters
    Type Name Description
    Unity.Entities.CodeGeneratedJobForEach.ForEachLambdaJobDescription description

    The target object

    NativeArray<T> componentArray

    NativeArray that contains the components.

    Type Parameters
    Name Description
    T

    The type of component to add.

    Remarks

    Can add any kind of component except chunk components, managed components, and shared components.

    componentArray.Length must match entityQuery.ToEntityArray().Length.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023