Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

EntityManager.GetAllUniqueSharedComponents

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void GetAllUniqueSharedComponents(out NativeList`1 sharedComponentValues, AllocatorHandle allocator);

Parameters

Parameter Description
sharedComponentValues A List<T> object to receive the unique instances of the shared component of type T.
allocator The allocator for the native list of sharedComponentValues

Description

Gets a list of all the unique instances of an unmanaged shared component type.

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.


Declaration

public void GetAllUniqueSharedComponents(out NativeList`1 sharedComponentValues, out NativeList`1 sharedComponentIndices, AllocatorHandle allocator);

Parameters

Parameter Description
sharedComponentValues A NativeList<T> to receive the unique instances of the shared component of type T.
sharedComponentIndices A NativeList<int> to receive the indices of those shared components in the internal shared component list.
allocator The allocator for the native lists.

Description

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.

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 EntityManager.GetSharedComponent, 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.