Construct an InterestQuery

Before reading this document, make sure you have read:

An InterestQuery object contains the constraint of a query and the components that the query will return from entities that match the given constraint.

Note: In the future, the Runtime will also provide functionality to limit the frequency at which a query returns results.

Create a query

To create an interest query, call InterestQuery.Query and provide a Constraint.

var query = InterestQuery

What constraints can I use?

To learn more about the available constraints, see:

To limit what components the query returns, you must set a filter. If no filter is set, the query will register interest for all components on matching entities.

(Optional) Set a filter

You can set a filter on which components to return in the query’s results. This is done by calling FilterResults and providing the component IDs of the components that you would like the query to return.

Similar to the Add, Replace and Clear functionality of the InterestTemplate class, the component IDs can either be provided as parameters or an enumerable set.

// Parameters
var query = InterestQuery
    .FilterResults(Position.ComponentId, Metadata.ComponentId);

// Enumerable
var resultComponentIds = new List() { Position.ComponentId, Metadata.ComponentId };
var query = InterestQuery

Updated about a year ago

Construct an InterestQuery

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.