docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method CopyFromComponentDataListAsync

    CopyFromComponentDataListAsync<T>(NativeList<T>, out JobHandle)

    Asynchronously copies the values of component type T in a NativeList into the entities matched by this query.

    Declaration
    public void CopyFromComponentDataListAsync<T>(NativeList<T> componentDataList, out JobHandle outJobHandle) where T : unmanaged, IComponentData
    Parameters
    Type Name Description
    NativeList<T> componentDataList

    The values to copy into the matching entities.

    JobHandle outJobHandle

    An out parameter assigned a handle that you can use as a dependency for a Job that should happen after this operation completes.

    Type Parameters
    Name Description
    T

    The component type.

    Remarks

    The job scheduled by this call will automatically use the component safety system to determine its input dependencies, to avoid the most common race conditions. If additional input dependencies are required beyond what the component safety system knows about, use CopyFromComponentDataListAsync<T>(NativeList<T>, JobHandle, out JobHandle).

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if T is not part of the query.

    CopyFromComponentDataListAsync<T>(NativeList<T>, JobHandle, out JobHandle)

    Asynchronously copies the values of component type T in a NativeList into the entities matched by this query.

    Declaration
    public void CopyFromComponentDataListAsync<T>(NativeList<T> componentDataList, JobHandle additionalInputDep, out JobHandle outJobHandle) where T : unmanaged, IComponentData
    Parameters
    Type Name Description
    NativeList<T> componentDataList

    The values to copy into the matching entities.

    JobHandle additionalInputDep

    A job handle which the newly scheduled job will depend upon, in addition to the dependencies automatically determined by the component safety system.

    JobHandle outJobHandle

    An out parameter assigned a handle that you can use as a dependency for a Job that should happen after this operation completes.

    Type Parameters
    Name Description
    T

    The component type.

    Remarks

    This method is generally used in conjunction with ToComponentDataListAsync<T>(AllocatorHandle, out JobHandle) to extract component values, pass them into some code that expects a flat array of values, and then scatter the updated values back to entities.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if T is not part of the query.

    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)