# CoherenceTagQuery

In addition to filtering object by distance using a [LiveQuery](https://docs.coherence.io/2.0/manual/components/coherence-live-query), coherence also supports **filtering objects by tag** with **CoherenceLiveQuery**. This is useful when you have some special objects that should always be visible regardless of their position.

{% hint style="info" %}
The tag used by the **CoherenceTagQuery** component is **not** based on [Unity's tag system](https://docs.unity3d.com/Manual/Tags.html).
{% endhint %}

{% hint style="warning" %}
Having **at least one query** in the scene **is necessary** to receive any network update!
{% endhint %}

## Using TagQueries

To create a TagQuery, right click a GameObject in the scene and select *coherence > TagQuery* from the context menu.

<figure><img src="https://215322450-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYYuUg3g2Mq8aiI7le9ai%2Fuploads%2Fgit-blob-b62869018e18b05af0bbd82a004e1a688fc0b9d5%2Fimage.png?alt=media" alt=""><figcaption><p>CoherenceTagQuery component</p></figcaption></figure>

All networked GameObjects with matching tags will now be visible to the Client. The **coherence** tag can be any string and can be configured in the *Advanced Settings* section of the `CoherenceSync` component.

![](https://215322450-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYYuUg3g2Mq8aiI7le9ai%2Fuploads%2Fgit-blob-f57a3257d68db40a7ba4112c56fd08fc7171c5c7%2Fcsync-tag-query.png?alt=media)

Tags and TagQueries can be updated at any time while the application is running, either from the Unity inspector or setting `CoherenceSync.coherenceTag` and `CoherenceTagQuery.coherenceTag` in code.

Multiple tags can be combined in a single TagQuery or tag on the CoherenceSync object as multiple strings comma-delimted or delimited by "|". Eg.: "red|blue". This example will match either "red" or "blue" or both.

All tags are compared case insensitive and white space is trimmed.

{% hint style="info" %}
In the future, we plan to integrate TagQueries with LiveQueries allowing combined query restrictions, e.g., only show objects with tag "red" within an extent of 50.
{% endhint %}

### Limits

The Replication Server imposes limits on number of queries a Client can create. Read more about it in the [Replication Server](https://docs.coherence.io/2.0/replication-server#maximum-query-count-per-client) section.
