Method GetSharedComponent
GetSharedComponent<T>(Entity)
Gets a shared component from an entity.
Declaration
public T GetSharedComponent<T>(Entity entity) where T : unmanaged, ISharedComponentData
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
Returns
Type | Description |
---|---|
T | A copy of the shared component. |
Type Parameters
Name | Description |
---|---|
T | The type of shared component. |
GetSharedComponent<T>(int)
Gets a shared component by index.
Declaration
public T GetSharedComponent<T>(int sharedComponentIndex) where T : unmanaged, ISharedComponentData
Parameters
Type | Name | Description |
---|---|---|
int | sharedComponentIndex | The index of the shared component in the internal shared component list. |
Returns
Type | Description |
---|---|
T | A copy of the shared component. |
Type Parameters
Name | Description |
---|---|
T | The data type of the shared component. |
Remarks
The ECS framework maintains an internal list of unique shared components. You can get the components in this list, along with their indices using GetAllUniqueSharedComponentsManaged<T>(List<T>, List<int>). An index in the list is valid and points to the same shared component index as long as the shared component order version from GetSharedComponentOrderVersion<T>(T) remains the same.