Tainted\\Coders

Metadata Components

Bevy version: 0.19Last updated:

When spawning tuple bundles it can sometimes difficult to identify their purpose:

// What am I?
commands.spawn(
  Position::default(),
  Velocity::default()
)

If we used an inspector such as the bevy-inspector-egui then it would be hard to identify which component is what just by their component list.

Remember that even when we use a named bundle, the bundle itself is ephemeral and only the components will remain afterwards.

One common alternative is to create components such as Player that can make querying easier. However, some components won't be queried and many component types can clutter up our code base.

So it can be useful to use Bevy's builtin a Name component that makes this debugging much easier:

commands.spawn((
  Name::new("Player"),
  Position::new(),
  Velocity::new()
))