Make entity observers more explicit #17187
Labels
A-ECS
Entities, components, systems, and events
C-Feature
A new feature, making something new possible
D-Modest
A "normal" level of difficulty; suitable for simple features or challenging fixes
S-Needs-Design
This issue requires design work to think about how it would best be accomplished
What problem does this solve or what need does it fill?
Right now, whether an observer is a listening globally or for triggers on specific entities is determined when it's added.
This presents an issue when trying to cache and reuse an observer. There needs to be an entity to watch, but that may be something spawned during gameplay and not in
Startup
where you would create such an observer.Since the Observer was created with no entities watched it will respond to events on everything, even after a specific entity to watch has been specified.
What solution would you like?
Ability/requirement to explicitly specify an
Observer
is or isn't targeted/global. Perhaps some way to switch between the two on the sameObserver
after creation. Control over the despawn on empty rule.What alternative(s) have you considered?
Right now a workaround is possible:
But it's not obvious, ugly and it also "disables" the feature that observer is removed after it's watched entities reach zero. Not to mention you have to know the quirk that
Observer
created with no entities is "global" and that's something you can't even check by querying theObserver
The text was updated successfully, but these errors were encountered: