Skip to content

Support require attribute in resource derive#24322

Merged
cart merged 1 commit into
bevyengine:mainfrom
musjj:resource-require
May 20, 2026
Merged

Support require attribute in resource derive#24322
cart merged 1 commit into
bevyengine:mainfrom
musjj:resource-require

Conversation

@musjj
Copy link
Copy Markdown
Contributor

@musjj musjj commented May 16, 2026

Objective

Resources are now components, which means that they should be capable of requiring other components. But this ability is not accessible in the derive macro.

Solution

Expose the require attribute in the Resource derive.

Testing

  • Did you test these changes? If so, how?

    $ cargo test -p ci
  • Are there any parts that need more testing?

    I'm not very familiar with the ecs internals, so additional eyes would be appreciated!

@SpecificProtagonist SpecificProtagonist added D-Trivial Nice and easy! A great choice to get started with Bevy A-ECS Entities, components, systems, and events S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it D-Macros Code that generates Rust code labels May 17, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in ECS May 17, 2026
@SpecificProtagonist SpecificProtagonist added this to the 0.19 milestone May 17, 2026
@cart cart added this pull request to the merge queue May 20, 2026
Merged via the queue into bevyengine:main with commit 2fc8ebb May 20, 2026
47 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in ECS May 20, 2026
mockersf pushed a commit to mockersf/bevy that referenced this pull request May 21, 2026
# Objective

Resources are now components, which means that they should be capable of
requiring other components. But this ability is not accessible in the
derive macro.

## Solution

Expose the `require` attribute in the `Resource` derive.

## Testing

- Did you test these changes? If so, how?
  ```bash
  $ cargo test -p ci
  ```

- Are there any parts that need more testing?

I'm not very familiar with the ecs internals, so additional eyes would
be appreciated!
mockersf pushed a commit that referenced this pull request May 21, 2026
# Objective

Resources are now components, which means that they should be capable of
requiring other components. But this ability is not accessible in the
derive macro.

## Solution

Expose the `require` attribute in the `Resource` derive.

## Testing

- Did you test these changes? If so, how?
  ```bash
  $ cargo test -p ci
  ```

- Are there any parts that need more testing?

I'm not very familiar with the ecs internals, so additional eyes would
be appreciated!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events D-Macros Code that generates Rust code D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants