Skip to content

Statically designate event targets #19564

Closed
@alice-i-cecile

Description

@alice-i-cecile

Originally posted by @cart in #16029

I don't think Option<Entity> is the right approach here. Events (or whatever we choose to call them) should be designed with a specific target type in mind (no target, entity target, component target, etc).

Right after we landed observers I implemented "static event targets", which removes the need for Option / PLACEHOLDER , makes it statically impossible for users to try to access a non-existent entity for a "global event", and general prevents expressing the "wrong" thing.

https://github.com/cart/bevy/tree/static-event-targets

Metadata

Metadata

Labels

A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesX-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers

Type

No type

Projects

Status

Observers - Completed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions