Method GetAllUniqueSharedComponents
GetAllUniqueSharedComponents<T>(out NativeList<T>, AllocatorHandle)
Gets a list of all the unique instances of an unmanaged shared component type.
Declaration
[GenerateTestsForBurstCompatibility(GenericTypeArguments = new Type[] { typeof(BurstCompatibleSharedComponentData) })]
public void GetAllUniqueSharedComponents<T>(out NativeList<T> sharedComponentValues, AllocatorManager.AllocatorHandle allocator) where T : unmanaged, ISharedComponentData
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | sharedComponentValues | A List<T> object to receive the unique instances of the shared component of type T. |
| AllocatorManager.AllocatorHandle | allocator | The allocator for the native list of sharedComponentValues |
Type Parameters
| Name | Description |
|---|---|
| T | The type of shared component. |
Remarks
All entities with the same archetype and the same values for a shared component are stored in the same set
of chunks. This function finds the unique shared components existing across chunks and archetype and
fills a list with copies of those components.
Note that the first element of the output list will always be the default value for T,
even if no entities or chunks currently use that value.
GetAllUniqueSharedComponents<T>(out NativeList<T>, out NativeList<int>, AllocatorHandle)
Gets a list of all the unique instances of an unmanaged shared component type and a corresponding list of indices into the internal shared component list.
Declaration
[GenerateTestsForBurstCompatibility(GenericTypeArguments = new Type[] { typeof(BurstCompatibleSharedComponentData) })]
public void GetAllUniqueSharedComponents<T>(out NativeList<T> sharedComponentValues, out NativeList<int> sharedComponentIndices, AllocatorManager.AllocatorHandle allocator) where T : unmanaged, ISharedComponentData
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | sharedComponentValues | A NativeList<T> to receive the unique instances of the shared component of type T. |
| NativeList<int> | sharedComponentIndices | A NativeList<int> to receive the indices of those shared components in the internal shared component list. |
| AllocatorManager.AllocatorHandle | allocator | The allocator for the native lists. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of shared component. |
Remarks
All entities with the same archetype and the same values for a shared component are stored in the same set
of chunks. This function finds the unique shared components existing across chunks and archetypes and
fills a list with copies of those components, plus a parallel list of their indices in the internal shared
component list. You can use the indices to ask for the same shared components directly by calling
GetSharedComponent<T>(int), passing in the index. An index remains valid until the shared
component order version changes.
Note that the first element of the output list will always be the default value for T,
even if no entities or chunks currently use that value.