# WithSharedComponentFilter

> Only select chunks that have a specified value for a shared component.

## Definition

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

## WithSharedComponentFilter\<T>(T)

Only select chunks that have a specified value for a shared component.

```csharp
public QueryEnumerableWithEntity<T1, T2, T3, T4, T5, T6> WithSharedComponentFilter<TSharedComponent1>(TSharedComponent1 sharedComponent) where TSharedComponent1 : struct, ISharedComponentData
```

### Parameters

**** (T): The value of `TSharedComponent1` which an entity must have in order to match this query

### Returns

| Type                                                                                                                         | Description                                                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [QueryEnumerableWithEntity\<T, U, V, W, X, Y>](/engine/7000.0/script-reference/unity/entities/queryenumerablewithentity6.md) | QueryEnumerableWithEntity, which allows enumerating over all RefRO, RefRW, components, EnabledRefRO, EnabledRefRW and entities that match the constructed Query. |

## WithSharedComponentFilter\<T, U>(T, T)

Only select chunks that have the specified values for two shared components.

```csharp
public QueryEnumerableWithEntity<T1, T2, T3, T4, T5, T6> WithSharedComponentFilter<TSharedComponent1, TSharedComponent2>(TSharedComponent1 sharedComponent1, TSharedComponent2 sharedComponent2) where TSharedComponent1 : struct, ISharedComponentData where TSharedComponent2 : struct, ISharedComponentData
```

### Parameters

**** (T): The value of `TSharedComponent1` which an entity must have in order to match this query**** (T): The value of `TSharedComponent2` which an entity must have in order to match this query

### Returns

| Type                                                                                                                         | Description                                                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [QueryEnumerableWithEntity\<T, U, V, W, X, Y>](/engine/7000.0/script-reference/unity/entities/queryenumerablewithentity6.md) | QueryEnumerableWithEntity, which allows enumerating over all RefRO, RefRW, components, EnabledRefRO, EnabledRefRW and entities that match the constructed Query. |
