Skip to content

Commit 2944f5e

Browse files
authored
Ignore RenderEntity during entity clones (#18798)
# Objective Fixes #18795 ## Solution Ignore RenderEntity during entity clones
1 parent e7558cd commit 2944f5e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

crates/bevy_render/src/sync_world.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use bevy_app::Plugin;
22
use bevy_derive::{Deref, DerefMut};
3+
use bevy_ecs::component::{ComponentCloneBehavior, Mutable, StorageType};
34
use bevy_ecs::entity::EntityHash;
45
use bevy_ecs::{
56
component::Component,
@@ -126,7 +127,7 @@ pub struct SyncToRenderWorld;
126127
/// Component added on the main world entities that are synced to the Render World in order to keep track of the corresponding render world entity.
127128
///
128129
/// Can also be used as a newtype wrapper for render world entities.
129-
#[derive(Component, Deref, Copy, Clone, Debug, Eq, Hash, PartialEq)]
130+
#[derive(Deref, Copy, Clone, Debug, Eq, Hash, PartialEq)]
130131
pub struct RenderEntity(Entity);
131132
impl RenderEntity {
132133
#[inline]
@@ -135,6 +136,16 @@ impl RenderEntity {
135136
}
136137
}
137138

139+
impl Component for RenderEntity {
140+
const STORAGE_TYPE: StorageType = StorageType::Table;
141+
142+
type Mutability = Mutable;
143+
144+
fn clone_behavior() -> ComponentCloneBehavior {
145+
ComponentCloneBehavior::Ignore
146+
}
147+
}
148+
138149
impl From<Entity> for RenderEntity {
139150
fn from(entity: Entity) -> Self {
140151
RenderEntity(entity)

0 commit comments

Comments
 (0)