docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetNativeArray

    GetNativeArray(EntityTypeHandle)

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

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

    An object containing type and job safety information. To create this object, call GetEntityTypeHandle(). 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>(ref ComponentTypeHandle<T>)

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

    Declaration
    public readonly NativeArray<T> GetNativeArray<T>(ref ComponentTypeHandle<T> typeHandle) where T : unmanaged, IComponentData
    Parameters
    Type Name Description
    ComponentTypeHandle<T> typeHandle

    An object containing type and job safety information. To create this object, call GetComponentTypeHandle<T>(bool). 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).

    GetNativeArray<T>(ComponentTypeHandle<T>)

    Obsolete. Use GetNativeArray<T>(ref ComponentTypeHandle<T>) instead.

    Declaration
    [Obsolete("The typeHandle argument should now be passed by ref. (RemovedAfter Entities 1.0)", false)]
    public readonly NativeArray<T> GetNativeArray<T>(ComponentTypeHandle<T> typeHandle) where T : unmanaged, IComponentData
    Parameters
    Type Name Description
    ComponentTypeHandle<T> typeHandle

    An object containing type and job safety information. To create this object, call GetComponentTypeHandle<T>(bool). 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.

    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)