Wildcard
constWildcard:ComponentHandle<unknown>
Defined in: src/handle.ts:669
Built-in component that acts as a wildcard in queries. It has two use cases:
- To query for all entities, including variations, such as components, systems and so on;
- To query for all sources or targets of a relationship, without caring about the other end of the relationship.
Example
Section titled “Example”// 1. Query all simple entities (entities that are not also components, systems, resources or plugins):query(Wildcard).withoutAny(Component, System, Resource, Plugin).forEach((id) => { ...})
// 2. Query all entities that are children of any other entity:query(pair(ChildOf, Wildcard)).forEach((child) => { const parent = child.targetOf(ChildOf)})