Closed JaimeGensler closed 9 months ago
Similar to the query.get() proposal, a query.single() API might be a nice addition for unique entities.
query.get()
query.single()
Query.p.single()method that returns the requested data for the entity that matches. Probably we just throw if 0 or multiple entities matches the query
Query.p.single()
function mySystem(query: Query<Position, With<IsPlayer>>) { const position = query.single(); }
Describe the problem this feature solves
Similar to the
query.get()
proposal, aquery.single()
API might be a nice addition for unique entities.Describe the solution you'd like to see
Query.p.single()
method that returns the requested data for the entity that matches. Probably we just throw if 0 or multiple entities matches the query