pub trait SetEntityEventTarget: EntityEvent {
// Required method
fn set_event_target(&mut self, entity: Entity);
}Expand description
A trait which is used to set the target of an EntityEvent.
By default, entity events are immutable; meaning their target does not change during the lifetime of the event. However, some events may require mutable access to provide features such as event propagation.
You should never need to implement this trait manually if you use #[derive(EntityEvent)]. It is automatically implemented for you if you
use #[entity_event(propagate)].
Required Methods§
Sourcefn set_event_target(&mut self, entity: Entity)
fn set_event_target(&mut self, entity: Entity)
Sets the Entity “target” of this EntityEvent. When triggered, this will run observers that watch for this specific entity.
Note: In general, this should not be called from within an Observer, as this will not “retarget”
the event in any of Bevy’s built-in Trigger implementations.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.