bevyengine / bevyengine/bevy

Unused Component/Resource Warning

Open
#9,776 4 comments 3 reactions 0 assignees View on GitHub
A-App A-ECS C-Feature
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?

It would be very nice if we had some tool that would emit a warning whenever a component or a resource is not a part of any query in the application.

Sometimes this scenario can result in hard to track down bugs.

We have a DespawnAfterDuration component / system we use. After moving the parent plugin around to a subcrate, but not remounting the plugin to the app, the component never gets processed as the system/plugin aren't added to the app builder.

Often times when moving code around / refactoring we'll forget to add a plugin / system etc. and we run into these sorts of things. Also very common for me when adding entirely new plugins / systems.

## What solution would you like?

Ideally a clippy lint / dead_code would be best I think.

## What alternative(s) have you considered?

I've attempted to just be better, but it hasn't worked out yet.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by studying how Bevy components and resources are registered through the app builder, plugins, systems, and queries. Define the warning's scope around components or resources absent from any application query, then determine how that behavior could be exposed as a lint or other tool and verify it against the described missing-plugin scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.