-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Add ability to inspect entity's components #5136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
inspect
command for debugging entities and their components #1467Solution
World::inspect_entity
. It accepts anEntity
and returns a vector of&ComponentInfo
that the entity has.EntityCommands::log_components
. It logs the component names of the entity. (info level)Changelog
Added
World::inspect_entity
orEntityCommands::log_components