Ignore RenderEntity during entity clones (#18798)

# Objective

Fixes #18795

## Solution

Ignore RenderEntity during entity clones
This commit is contained in:
Carter Anderson 2025-04-10 13:46:34 -07:00 committed by François Mockers
parent 9ef8d19590
commit 5db383ca9c

View File

@ -1,5 +1,6 @@
use bevy_app::Plugin;
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::component::{ComponentCloneBehavior, Mutable, StorageType};
use bevy_ecs::entity::EntityHash;
use bevy_ecs::{
component::Component,
@ -126,7 +127,7 @@ pub struct SyncToRenderWorld;
/// 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.
///
/// Can also be used as a newtype wrapper for render world entities.
#[derive(Component, Deref, Copy, Clone, Debug, Eq, Hash, PartialEq)]
#[derive(Deref, Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub struct RenderEntity(Entity);
impl RenderEntity {
#[inline]
@ -135,6 +136,16 @@ impl RenderEntity {
}
}
impl Component for RenderEntity {
const STORAGE_TYPE: StorageType = StorageType::Table;
type Mutability = Mutable;
fn clone_behavior() -> ComponentCloneBehavior {
ComponentCloneBehavior::Ignore
}
}
impl From<Entity> for RenderEntity {
fn from(entity: Entity) -> Self {
RenderEntity(entity)