Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Display implementation to DebugName. (#13760)
# Objective - When writing "in game" debugging tools, quite often you need the name of an entity (for example an entity tree). DebugName is the usual way of doing that. - A recent change to Entity's Debug implementation meant it was no longer a minimal {index}v{generation} but instead a more verbose auto generated Debug. - This made DebugName's Debug implementation also verbose ## Solution - I changed DebugName to derive Debug automatically and added a new (preferred) Display implementation for it which is the preferred name for an entity. If the entity has a Name component its the contents of that, otherwise it is {index}v{generation} (though this does not use Display of the Entity as that is more verbose than this). ## Testing - I've added a new test in name.rs which tests the Display implementation for DebugName by using to_string. --- ## Migration Guide - In code which uses DebugName you should now use the Display implementation rather than the Debug implementation (ie {} instead of {:?} if you were printing it out). --------- Co-authored-by: John Payne <20407779+johngpayne@users.noreply.github.com> Co-authored-by: Jan Hohenheim <jan@hohenheim.ch> Co-authored-by: Andres O. Vela <andresovela@users.noreply.github.com>
- Loading branch information