mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
937fc039b1
# Objective - Trying to make it easier to have a more user friendly debugging name for when you want to print out an entity. ## Solution - Add a new `WorldQuery` struct `DebugName` to format the `Name` if the entity has one, otherwise formats the `Entity` id. This means we can do this and get more descriptive errors without much more effort: ```rust fn my_system(moving: Query<(DebugName, &mut Position, &Velocity)>) { for (name, mut position, velocity) in &mut moving { position += velocity; if position.is_nan() { error!("{:?} has an invalid position state", name); } } } ``` --- ## Changelog - Added `DebugName` world query for more human friendly debug names of entities. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |