Skip to content

Commit

Permalink
Fix gizmos (#15836)
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
tim-blackbird authored Oct 10, 2024
1 parent da211ee commit 5def6f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/bevy_gizmos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ use crate::config::GizmoMeshConfig;
use {
bevy_ecs::{
component::Component,
entity::Entity,
query::ROQueryItem,
system::{
lifetimeless::{Read, SRes},
Expand All @@ -109,7 +110,7 @@ use {
ShaderStages, ShaderType, VertexFormat,
},
renderer::RenderDevice,
sync_world::TemporaryRenderEntity,
sync_world::{MainEntity, TemporaryRenderEntity},
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
},
bytemuck::cast_slice,
Expand Down Expand Up @@ -467,6 +468,9 @@ fn extract_gizmo_data(
render_layers: config.render_layers.clone(),
handle: handle.clone(),
},
// The immediate mode API does not have a main world entity to refer to,
// but we do need MainEntity on this render entity for the systems to find it.
MainEntity::from(Entity::PLACEHOLDER),
TemporaryRenderEntity,
));
}
Expand Down

0 comments on commit 5def6f2

Please sign in to comment.