[Merged by Bors] - Add ability to inspect entity's components#5136
[Merged by Bors] - Add ability to inspect entity's components#5136harudagondi wants to merge 7 commits intobevyengine:mainfrom
Conversation
alice-i-cecile
left a comment
There was a problem hiding this comment.
My first instinct was "why isn't this a Debug implementation on Entity". But of course, that won't work: Entity is just a raw identifier.
This is quite nice, but I would actually also like Components::inspect_entity, which will make this trivial to do in the middle of systems without blocking parallelization, as you can fetch &Components as a system parameter.
Once that's done I'll have a few suggestions on docs; in particular I think that we'll want to demonstrate that functionality.
Nilirad
left a comment
There was a problem hiding this comment.
This is a very nice feature :)
The changes look ok. Once DebugEntity gets documented this should be ready to be merged.
See if you can optimize the World::inspect_entity method. I would not define it a hard requirement, but it could significantly speed up the execution.
Thanks 😃
Curious, how would this implementation looks like? I imagine |
|
Oh I see; this is less trivial than I expected. I'm happy with this now then. |
|
This new commands can be called by Also, as it's in debug which is disabled by default, could you add to the doc comment how to enable those logs? (Setting log level for As is, this log looks like this: I'm not sure all those info are very useful, could that be simplified? |
I wonder if it should be |
|
So, to summarize the requested changes:
|
- Simplified log output to show only the name. - moved the function to `EntityCommands` - change log level to INFO
|
Changes look good. I would still like to see less information in the debug logs, but I won't block on that. |
|
bors r+ |
# Objective - Provide a way to see the components of an entity. - Fixes #1467 ## Solution - Add `World::inspect_entity`. It accepts an `Entity` and returns a vector of `&ComponentInfo` that the entity has. - Add `EntityCommands::log_components`. It logs the component names of the entity. (info level) --- ## Changelog ### Added - Ability to inspect components of an entity through `World::inspect_entity` or `EntityCommands::log_components`
# Objective - Provide a way to see the components of an entity. - Fixes bevyengine#1467 ## Solution - Add `World::inspect_entity`. It accepts an `Entity` and returns a vector of `&ComponentInfo` that the entity has. - Add `EntityCommands::log_components`. It logs the component names of the entity. (info level) --- ## Changelog ### Added - Ability to inspect components of an entity through `World::inspect_entity` or `EntityCommands::log_components`
# Objective - Provide a way to see the components of an entity. - Fixes bevyengine#1467 ## Solution - Add `World::inspect_entity`. It accepts an `Entity` and returns a vector of `&ComponentInfo` that the entity has. - Add `EntityCommands::log_components`. It logs the component names of the entity. (info level) --- ## Changelog ### Added - Ability to inspect components of an entity through `World::inspect_entity` or `EntityCommands::log_components`
# Objective - Provide a way to see the components of an entity. - Fixes bevyengine#1467 ## Solution - Add `World::inspect_entity`. It accepts an `Entity` and returns a vector of `&ComponentInfo` that the entity has. - Add `EntityCommands::log_components`. It logs the component names of the entity. (info level) --- ## Changelog ### Added - Ability to inspect components of an entity through `World::inspect_entity` or `EntityCommands::log_components`
Objective
inspectcommand for debugging entities and their components #1467Solution
World::inspect_entity. It accepts anEntityand returns a vector of&ComponentInfothat the entity has.EntityCommands::log_components. It logs the component names of the entity. (info level)Changelog
Added
World::inspect_entityorEntityCommands::log_components