docs.unity3d.com
    Show / Hide Table of Contents

    Struct NativeArraySharedInt

    Merge sort index list referencing NativeArray values. Provide list of shared values, indices to shared values, and lists of source i value indices with identical shared value. As an example: Given Source NativeArray: [A,A,A,B,B,C,C,A,B] Provides: Shared value indices: [0,0,0,1,1,2,2,0,1] Shared value counts: [4,3,2] (number of occurrences of a shared value) Shared values: [A,B,C] (not stored in this structure) Sorted indices: [0,1,2,7,3,4,8,5,6] (using these indices to look up values in the source array would give you [A,A,A,A,B,B,B,C,C]) Shared value start offsets (into sorted indices): [0,4,7]

    Namespace: Unity.Entities
    Syntax
    public struct NativeArraySharedInt : IDisposable

    Constructors

    Name Description
    NativeArraySharedInt(NativeArray<Int32>, Allocator)

    Properties

    Name Description
    SharedValueCount

    Number of shared (unique) values in source NativeArray

    SourceBuffer

    Original Source Values (passed into constructor)

    Methods

    Name Description
    Dispose()
    GetSharedIndexArray()

    Indices into shared values. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] shared index array would contain: [0,0,0,1,1,2,2,0,1]

    GetSharedIndexBySourceIndex(Int32)

    Index of shared value associated with an element in the source buffer. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Given the index 2 into the source array (A), the return value would be 0 (A in shared values).

    GetSharedValueIndexCountArray()

    Array of number of occurrences of all shared values. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value counts: [4,3,2] (number of occurrences of a shared value)

    GetSharedValueIndexCountBySourceIndex(Int32)

    Number of occurrences of a shared (unique) value shared by a given a source index. For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value counts: [4,3,2] (number of occurrences of a shared value) Given the index 2 into the source array (A), the return value would be 4 (for 4 occurrences of A in the source buffer).

    GetSharedValueIndicesBySharedIndex(Int32)

    Array of indices into source NativeArray which share the same shared value For example, given source array: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value counts: [4,3,2] (number of occurrences of a shared value) Shared value start offsets (into sorted indices): [0,4,7] Given the index 0 into the shared value array (A), the returned array would contain [0,1,2,7] (indices into the source array which point to the shared value A).

    GetSharedValueIndicesBySourceIndex(Int32)

    Array of indices into shared value indices NativeArray which share the same source value For example, given Source NativeArray: [A,A,A,B,B,C,C,A,B] shared values are: [A,B,C] Shared value indices: [0,0,0,1,1,2,2,0,1] Given the index 2 into the source array (A), the returned array would contain: [0,1,2,7] (indices in SharedValueIndices that have a value of 0, i.e. where A is in the shared values)

    GetSortedIndices()

    Indices into source NativeArray sorted by value

    Schedule(JobHandle)

    Schedule jobs to collect and sort shared values.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023