# GetSharedComponent

> Gets the current value of an unmanaged shared component.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

## GetSharedComponent\<T>(SharedComponentTypeHandle\<T>, EntityManager)

Gets the current value of an unmanaged shared component.

```csharp
public readonly T GetSharedComponent<T>(SharedComponentTypeHandle<T> chunkSharedComponentData, EntityManager entityManager) where T : unmanaged, ISharedComponentData
```

### Parameters

**** (\[SharedComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/sharedcomponenttypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetSharedComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getsharedcomponenttypehandle.md).**** (\[EntityManager]\(/engine/7000.0/script-reference/unity/entities/entitymanager)): The [EntityManager](/engine/7000.0/script-reference/unity/entities/entitymanager.md) through which the shared component value should be retrieved.

### Returns

| Type | Description                 |
| ---- | --------------------------- |
| T    | The shared component value. |

## GetSharedComponent\<T>(SharedComponentTypeHandle\<T>)

Gets the current value of an unmanaged shared component.

```csharp
public readonly T GetSharedComponent<T>(SharedComponentTypeHandle<T> chunkSharedComponentData) where T : unmanaged, ISharedComponentData
```

### Parameters

**** (\[SharedComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/sharedcomponenttypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetSharedComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getsharedcomponenttypehandle.md).

### Returns

| Type | Description                 |
| ---- | --------------------------- |
| T    | The shared component value. |

## GetSharedComponent\<T>(SharedComponentTypeHandle\<T>)

Gets the current value of an unmanaged shared component.

```csharp
public readonly T GetSharedComponent<T>(ref SharedComponentTypeHandle<T> chunkSharedComponentData) where T : unmanaged, ISharedComponentData
```

### Parameters

**** (\[SharedComponentTypeHandle\<T>]\(/engine/7000.0/script-reference/unity/entities/sharedcomponenttypehandle1)): An object containing type and job safety information. To create this object, call [ComponentSystemBase.GetSharedComponentTypeHandle](/engine/7000.0/script-reference/unity/entities/componentsystembase/getsharedcomponenttypehandle.md).

### Returns

| Type | Description                 |
| ---- | --------------------------- |
| T    | The shared component value. |
