logo
pub trait ComponentExt {
    fn on_added(&self) { ... }
    fn on_removed(&self) { ... }
    fn on_start(&self) { ... }
    fn on_stop(&self) { ... }
    fn on_update(&self, dt: f32) { ... }
    fn name(&self) -> Option<String> { ... }
}

Provided Methods

Called after this component has been added to an entity.

Called just before this component has been removed from its entity.

Called just before this component’s first update after being added. This is the best place to put initialization logic that requires accessing other components/entities, since it waits until the rest of the entity hierarchy is accessible.

Note that on_start may be delayed until the next frame after adding a component, depending on where in the update step it was added.

Called just before this component will be removed from its entity, if on_start was previously called.

Called when this component receives a game update. @param dt The time elapsed since the last frame, in seconds.

Implementors