From 4852fc7578b7a55db4c05a6fb9f8ebdd290571e1 Mon Sep 17 00:00:00 2001 From: Doonv <58695417+doonv@users.noreply.github.com> Date: Tue, 7 Nov 2023 23:25:00 +0200 Subject: [PATCH] Implement Clone for VisibilityBundle and SpatialBundle (#10394) # Objective Had an issue where I had `VisibilityBundle` inside a bundle that implements `Clone`, but since `VisibilityBundle` doesn't implement `Clone` that wasn't possible. This PR fixes that. ## Solution Implement `Clone` for `VisibilityBundle` by deriving it. And also `SpatialBundle` too because why not. --- ## Changelog - Added implementation for `Clone` on `VisibilityBundle` and `SpatialBundle`. --- crates/bevy_render/src/spatial_bundle.rs | 2 +- crates/bevy_render/src/view/visibility/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/spatial_bundle.rs b/crates/bevy_render/src/spatial_bundle.rs index 27dba5c215..d8e749cf0b 100644 --- a/crates/bevy_render/src/spatial_bundle.rs +++ b/crates/bevy_render/src/spatial_bundle.rs @@ -15,7 +15,7 @@ use crate::view::{InheritedVisibility, ViewVisibility, Visibility}; /// to be rendered correctly. /// /// [`Component`]: bevy_ecs::component::Component -#[derive(Bundle, Debug, Default)] +#[derive(Bundle, Clone, Debug, Default)] pub struct SpatialBundle { /// The visibility of the entity. pub visibility: Visibility, diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index 8b2a98e7e7..0bd224f4d4 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -135,7 +135,7 @@ impl ViewVisibility { /// * To get the inherited visibility of an entity, you should get its [`InheritedVisibility`]. /// * For visibility hierarchies to work correctly, you must have both all of [`Visibility`], [`InheritedVisibility`], and [`ViewVisibility`]. /// * You may use the [`VisibilityBundle`] to guarantee this. -#[derive(Bundle, Debug, Default)] +#[derive(Bundle, Debug, Clone, Default)] pub struct VisibilityBundle { /// The visibility of the entity. pub visibility: Visibility,