docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AddChunkComponentData

    AddChunkComponentData<T>(ForEachLambdaJobDescription, T)

    Adds a chunk component to each of the chunks identified by the query you have defined using WithAny/WithAll/WithNone and sets the component values.

    Declaration
    public static void AddChunkComponentData<T>(this ForEachLambdaJobDescription description, T componentData) where T : unmanaged, IComponentData
    Parameters
    Type Name Description
    ForEachLambdaJobDescription description

    The target object

    T componentData

    The data to set.

    Type Parameters
    Name Description
    T

    The type of component, which must implement IComponentData.

    Remarks

    This function finds all chunks whose archetype satisfies the EntityQuery and adds the specified component to them.

    A chunk component is common to all entities in a chunk. You can access a chunk IComponentData instance through either the chunk itself or through an entity stored in that chunk.

    Important: This function creates a sync point, which means that the EntityManager waits for all currently running Jobs to complete before adding the component and no additional Jobs can start before the function is finished. A sync point can cause a drop in performance because the ECS framework may not be able to make use of the processing power of all available cores.

    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)