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:
		
							parent
							
								
									c98481aa56
								
							
						
					
					
						commit
						4852fc7578
					
				| @ -15,7 +15,7 @@ use crate::view::{InheritedVisibility, ViewVisibility, Visibility}; | |||||||
| /// to be rendered correctly.
 | /// to be rendered correctly.
 | ||||||
| ///
 | ///
 | ||||||
| /// [`Component`]: bevy_ecs::component::Component
 | /// [`Component`]: bevy_ecs::component::Component
 | ||||||
| #[derive(Bundle, Debug, Default)] | #[derive(Bundle, Clone, Debug, Default)] | ||||||
| pub struct SpatialBundle { | pub struct SpatialBundle { | ||||||
|     /// The visibility of the entity.
 |     /// The visibility of the entity.
 | ||||||
|     pub visibility: Visibility, |     pub visibility: Visibility, | ||||||
|  | |||||||
| @ -135,7 +135,7 @@ impl ViewVisibility { | |||||||
| /// * To get the inherited visibility of an entity, you should get its [`InheritedVisibility`].
 | /// * 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`].
 | /// * For visibility hierarchies to work correctly, you must have both all of [`Visibility`], [`InheritedVisibility`], and [`ViewVisibility`].
 | ||||||
| ///   * You may use the [`VisibilityBundle`] to guarantee this.
 | ///   * You may use the [`VisibilityBundle`] to guarantee this.
 | ||||||
| #[derive(Bundle, Debug, Default)] | #[derive(Bundle, Debug, Clone, Default)] | ||||||
| pub struct VisibilityBundle { | pub struct VisibilityBundle { | ||||||
|     /// The visibility of the entity.
 |     /// The visibility of the entity.
 | ||||||
|     pub visibility: Visibility, |     pub visibility: Visibility, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Doonv
						Doonv