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`.
This commit is contained in:
Doonv 2023-11-07 23:25:00 +02:00 committed by GitHub
parent c98481aa56
commit 4852fc7578
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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,

View file

@ -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,