bevyengine / bevyengine/bevy

Allow inspecting `World` for debugging entity issues and other

Open
#3,860 1 comment 0 reactions 0 assignees View on GitHub
A-ECS C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

Trying to find why an `Entity` is not found in the render `World` by dumping that world with a `trace!()` just before panic.

## What solution would you like?

Allow iterating somehow on entities, components, and archetypes, to allow debugging. Or at least allow dumping the archetypes. Currently only `Entities` and `Components` implement `Debug`, not `Archetypes`. And entities have no ID, only an `EntityLocation` that seem to refer to the archetype. So one cannot locate an entity by ID into a world.

## What alternative(s) have you considered?

I don't see any. `trace!()` is already a last-resort technique which dumps in a rather indigestible format; I would have preferred allowing direct read-only iteration (though can understand if that's forbidden for ECS safety reasons).

## Additional context

Trying to debug `thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NoSuchEntity',`. I know the entity ID, but cannot see if it's in the world, or what other entities are there that would guide my debugging.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the World, Entities, Components, and Archetypes APIs, especially their existing Debug implementations and EntityLocation representation. Determine how read-only inspection could expose entities, components, or archetypes for debugging, then verify that the requested entity ID and relevant world contents can be identified without violating ECS safety.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.