Skip to content

Instantly share code, notes, and snippets.

@janhohenheim
Created October 17, 2025 22:17
Show Gist options
  • Select an option

  • Save janhohenheim/eeee75859d92b08c72d62659f367958e to your computer and use it in GitHub Desktop.

Select an option

Save janhohenheim/eeee75859d92b08c72d62659f367958e to your computer and use it in GitHub Desktop.
Print all Components
fn plugin(app: &mut App) {
app.add_systems(
Update,
trigger_print.run_if(input_just_pressed(KeyCode::F3)),
);
app.add_observer(print);
}
#[derive(EntityEvent)]
struct Print(Entity);
fn trigger_print(to_inspect: Single<Entity, With<SamplePlayer>>, mut commands: Commands) {
commands.trigger(Print(to_inspect.into_inner()));
}
fn print(print: On<Print>, world: &World) {
info!(
"{:#?}",
world
.inspect_entity(print.0)
.unwrap()
.map(|info| info.name())
.collect::<Vec<_>>()
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment