# SetSharedComponentFilter

> Filters this EntityQuery so that it only selects entities with shared component of type SharedComponent equal to sharedComponent.

## Definition

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

## SetSharedComponentFilter\<T>(T)

Filters this EntityQuery so that it only selects entities with shared component of type `SharedComponent` equal to `sharedComponent`.

```csharp
public void SetSharedComponentFilter<SharedComponent>(SharedComponent sharedComponent) where SharedComponent : unmanaged, ISharedComponentData
```

### Parameters

**** (T): The shared component value to filter.

### Remarks

This call disables any existing chunk filtering on this query. For additive filtering, use [EntityQuery.AddSharedComponentFilter](/engine/7000.0/script-reference/unity/entities/entityquery/addsharedcomponentfilter.md).

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

Filters this EntityQuery based on the values of two separate unmanaged shared components.

```csharp
public void SetSharedComponentFilter<SharedComponent1, SharedComponent2>(SharedComponent1 sharedComponent1, SharedComponent2 sharedComponent2) where SharedComponent1 : unmanaged, ISharedComponentData where SharedComponent2 : unmanaged, ISharedComponentData
```

### Parameters

**** (T): Shared component value to filter.**** (T): Shared component value to filter.

### Remarks

The filter only selects entities which have both a shared component of type `SharedComponent1` whose value equals `sharedComponent1` and a shared component of type `SharedComponent2` whose value equals `sharedComponent2`. This call disables any existing chunk filtering on this query. For additive filtering, use [EntityQuery.AddSharedComponentFilter](/engine/7000.0/script-reference/unity/entities/entityquery/addsharedcomponentfilter.md).
