# 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 QueryEnumerable<T1, T2, T3> WithSharedComponentFilter<TSharedComponent1>(TSharedComponent1 sharedComponent) where TSharedComponent1 : unmanaged, ISharedComponentData
```

### Parameters

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

### Returns

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

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

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

```csharp
public QueryEnumerable<T1, T2, T3> WithSharedComponentFilter<TSharedComponent1, TSharedComponent2>(TSharedComponent1 sharedComponent1, TSharedComponent2 sharedComponent2) where TSharedComponent1 : unmanaged, ISharedComponentData where TSharedComponent2 : unmanaged, 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                                                                                                                                 |
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| [QueryEnumerable\<T, U, V>](/engine/7000.0/script-reference/unity/entities/queryenumerable3.md) | QueryEnumerable, which allows enumerating over all RefRO, RefRW, EnabledRefRO and EnabledRefRW components that match the constructed Query. |
