Skip to content

Commit 5def6f2

Browse files
Fix gizmos (#15836)
# Objective - Immediate mode gizmos don't have a main world entity but the phase items require `MainEntity` since #15756 ## Solution - Add a dummy `MainEntity` component. ## Testing Both the `3d_gizmos` and `2d_gizmos` examples show gizmos again
1 parent da211ee commit 5def6f2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/bevy_gizmos/src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ use crate::config::GizmoMeshConfig;
9393
use {
9494
bevy_ecs::{
9595
component::Component,
96+
entity::Entity,
9697
query::ROQueryItem,
9798
system::{
9899
lifetimeless::{Read, SRes},
@@ -109,7 +110,7 @@ use {
109110
ShaderStages, ShaderType, VertexFormat,
110111
},
111112
renderer::RenderDevice,
112-
sync_world::TemporaryRenderEntity,
113+
sync_world::{MainEntity, TemporaryRenderEntity},
113114
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
114115
},
115116
bytemuck::cast_slice,
@@ -467,6 +468,9 @@ fn extract_gizmo_data(
467468
render_layers: config.render_layers.clone(),
468469
handle: handle.clone(),
469470
},
471+
// The immediate mode API does not have a main world entity to refer to,
472+
// but we do need MainEntity on this render entity for the systems to find it.
473+
MainEntity::from(Entity::PLACEHOLDER),
470474
TemporaryRenderEntity,
471475
));
472476
}

0 commit comments

Comments
 (0)