Skip to content

enable_state_scoped_entities() as a derive attribute#16180

Merged
mockersf merged 4 commits intobevyengine:mainfrom
mockersf:statescoped-as-derive-attribute
Dec 1, 2024
Merged

enable_state_scoped_entities() as a derive attribute#16180
mockersf merged 4 commits intobevyengine:mainfrom
mockersf:statescoped-as-derive-attribute

Conversation

@mockersf
Copy link
Copy Markdown
Member

@mockersf mockersf commented Oct 30, 2024

Objective

  • I got tired of calling enable_state_scoped_entities, and though it would make more sense to define that at the place where the state is defined

Solution

  • add a derive attribute #[states(scoped_entities)] when derive States or SubStates that enables it automatically when adding the state

Testing

  • Ran the examples using it, they still work

@mockersf mockersf added the A-States App-level states machines label Oct 30, 2024
@alice-i-cecile alice-i-cecile added C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 30, 2024
@mockersf mockersf force-pushed the statescoped-as-derive-attribute branch from 3a5fba2 to fcd778b Compare October 30, 2024 23:55
@BenjaminBrienen BenjaminBrienen added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 31, 2024
@mockersf mockersf added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Nov 1, 2024
@mweatherley mweatherley added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 27, 2024
@alice-i-cecile alice-i-cecile added this to the 0.16 milestone Nov 27, 2024
@mockersf mockersf added this pull request to the merge queue Dec 1, 2024
Merged via the queue into bevyengine:main with commit fcfb685 Dec 1, 2024
ecoskey pushed a commit to ecoskey/bevy that referenced this pull request Dec 2, 2024
# Objective

- I got tired of calling `enable_state_scoped_entities`, and though it
would make more sense to define that at the place where the state is
defined

## Solution

- add a derive attribute `#[states(scoped_entities)]` when derive
`States` or `SubStates` that enables it automatically when adding the
state

## Testing

- Ran the examples using it, they still work
ecoskey pushed a commit to ecoskey/bevy that referenced this pull request Jan 6, 2025
# Objective

- I got tired of calling `enable_state_scoped_entities`, and though it
would make more sense to define that at the place where the state is
defined

## Solution

- add a derive attribute `#[states(scoped_entities)]` when derive
`States` or `SubStates` that enables it automatically when adding the
state

## Testing

- Ran the examples using it, they still work
github-merge-queue bot pushed a commit that referenced this pull request Sep 8, 2025
# Objective

- Reverts #16180
- Fixes #20866

## Solution

- Just enable state scoped entities all the time. No need to keep API
surface for disabling that tiiiiiny bit of overhead. If someone needs
this, we can still trivially add it back.

## Testing

- `bevy run --example state_scope`

---------

Co-authored-by: Alice Cecile <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-States App-level states machines C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants