Skip to content

Commit f3e7a4b

Browse files
authored
Added clone bounds to EntityEvents that were missing them. (#19708)
# Objective Lack of clone on certain builtin events ## Solution Added clone to those events ## Testing ## Showcase
1 parent 66086a2 commit f3e7a4b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/bevy_core_widgets/src/core_slider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ pub(crate) fn slider_on_insert_step(trigger: On<Insert, SliderStep>, mut world:
461461
/// commands.trigger_targets(SetSliderValue::Relative(-0.25), slider);
462462
/// }
463463
/// ```
464-
#[derive(Event, EntityEvent)]
464+
#[derive(Event, EntityEvent, Clone)]
465465
pub enum SetSliderValue {
466466
/// Set the slider value to a specific value.
467467
Absolute(f32),

crates/bevy_ecs/src/lifecycle.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub const DESPAWN: ComponentId = ComponentId::new(4);
328328
/// Trigger emitted when a component is inserted onto an entity that does not already have that
329329
/// component. Runs before `Insert`.
330330
/// See [`crate::lifecycle::ComponentHooks::on_add`] for more information.
331-
#[derive(Event, EntityEvent, Debug)]
331+
#[derive(Event, EntityEvent, Debug, Clone)]
332332
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
333333
#[cfg_attr(feature = "bevy_reflect", reflect(Debug))]
334334
#[doc(alias = "OnAdd")]
@@ -337,7 +337,7 @@ pub struct Add;
337337
/// Trigger emitted when a component is inserted, regardless of whether or not the entity already
338338
/// had that component. Runs after `Add`, if it ran.
339339
/// See [`crate::lifecycle::ComponentHooks::on_insert`] for more information.
340-
#[derive(Event, EntityEvent, Debug)]
340+
#[derive(Event, EntityEvent, Debug, Clone)]
341341
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
342342
#[cfg_attr(feature = "bevy_reflect", reflect(Debug))]
343343
#[doc(alias = "OnInsert")]
@@ -348,7 +348,7 @@ pub struct Insert;
348348
///
349349
/// Runs before the value is replaced, so you can still access the original component data.
350350
/// See [`crate::lifecycle::ComponentHooks::on_replace`] for more information.
351-
#[derive(Event, EntityEvent, Debug)]
351+
#[derive(Event, EntityEvent, Debug, Clone)]
352352
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
353353
#[cfg_attr(feature = "bevy_reflect", reflect(Debug))]
354354
#[doc(alias = "OnReplace")]
@@ -357,15 +357,15 @@ pub struct Replace;
357357
/// Trigger emitted when a component is removed from an entity, and runs before the component is
358358
/// removed, so you can still access the component data.
359359
/// See [`crate::lifecycle::ComponentHooks::on_remove`] for more information.
360-
#[derive(Event, EntityEvent, Debug)]
360+
#[derive(Event, EntityEvent, Debug, Clone)]
361361
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
362362
#[cfg_attr(feature = "bevy_reflect", reflect(Debug))]
363363
#[doc(alias = "OnRemove")]
364364
pub struct Remove;
365365

366366
/// Trigger emitted for each component on an entity when it is despawned.
367367
/// See [`crate::lifecycle::ComponentHooks::on_despawn`] for more information.
368-
#[derive(Event, EntityEvent, Debug)]
368+
#[derive(Event, EntityEvent, Debug, Clone)]
369369
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
370370
#[cfg_attr(feature = "bevy_reflect", reflect(Debug))]
371371
#[doc(alias = "OnDespawn")]

0 commit comments

Comments
 (0)