Open
Description
Bevy version
0.15
What you did
Added a picking observer.
What went wrong
.observe(|trigger: Trigger<Pointer<Click>>| {
info!(
"Clicked: picking target:{}, target():{}, observer():{}",
trigger.target,
trigger.target(),
trigger.observer()
);
});
This prints out three different entities.
Additional information
Discussion on discord:
https://discord.com/channels/691052431525675048/749335865876021248/1324499473098870896
Consider renaming:
target
: the entity on which the event is firedlistener
/observed
: the entity to which the observer is attached (wastarget
)observed_by
: the entity which holds the observer component (wasobserver
)- Can we just hide this entirely, and instead provide
remove_observer
? The fact that the observer lives on its own entity and is not actually a component on the listener is a confusing implementation detail that I think we should hide from the user. - As far as the user is concerned, they have no idea that
.observe()
spawns a new entity, to them, the API looks like they are attaching something to the "listener" entity.
- Can we just hide this entirely, and instead provide