docs.unity.cn
    Show / Hide Table of Contents

    Method GetNativeArray

    GetNativeArray(EntityTypeHandle)

    Provides a native array interface to entity instances stored in this chunk.

    Declaration
    public NativeArray<Entity> GetNativeArray(EntityTypeHandle entityTypeHandle)
    Parameters
    Type Name Description
    EntityTypeHandle entityTypeHandle

    An object containing type and job safety information. Create this object by calling GetEntityTypeHandle() immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.

    Returns
    Type Description
    NativeArray<Entity>

    A native array containing the entities in the chunk.

    Remarks

    The native array returned by this method references existing data, not a copy.

    GetNativeArray<T>(ComponentTypeHandle<T>)

    Provides a native array interface to components stored in this chunk.

    Declaration
    public NativeArray<T> GetNativeArray<T>(ComponentTypeHandle<T> chunkComponentTypeHandle)
        where T : struct, IComponentData
    Parameters
    Type Name Description
    ComponentTypeHandle<T> chunkComponentTypeHandle

    An object containing type and job safety information. Create this object by calling GetComponentTypeHandle<T>(Boolean)immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.

    Returns
    Type Description
    NativeArray<T>

    A native array containing the components in the chunk.

    Type Parameters
    Name Description
    T

    The data type of the component.

    Remarks

    The native array returned by this method references existing data, not a copy.

    Exceptions
    Type Condition
    ArgumentException

    If you call this function on a "tag" component type (which is an empty component with no fields).

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Wednesday, July 6, 2022
    Terms of use