Skip to content

Store registered system as Option and take it when running #22437

Merged
cart merged 2 commits intobevyengine:mainfrom
cart:registered_system_option
Jan 8, 2026
Merged

Store registered system as Option and take it when running #22437
cart merged 2 commits intobevyengine:mainfrom
cart:registered_system_option

Conversation

@cart
Copy link
Member

@cart cart commented Jan 8, 2026

Objective

Fixes #22380

Solution

  • Store the registered system as Option
  • Take it when running instead of removing RegisteredSystem

This prevents a flush of the global command buffer and also enables running one-shot systems without changing the shape of entities (opening up DeferredWorld scenarios).

Testing

@cart cart added this to the 0.18 milestone Jan 8, 2026
@cart cart added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Jan 8, 2026
@alice-i-cecile alice-i-cecile added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Jan 8, 2026
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a clean design!

Copy link
Member

@CorvusPrudens CorvusPrudens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can also confirm the panic is resolved!

@alice-i-cecile alice-i-cecile 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 Jan 8, 2026
@cart cart enabled auto-merge January 8, 2026 22:22
@cart cart added this pull request to the merge queue Jan 8, 2026
Merged via the queue into bevyengine:main with commit 86db2d2 Jan 8, 2026
38 checks passed
cart added a commit that referenced this pull request Jan 9, 2026
# Objective

Fixes #22380

## Solution

- Store the registered system as Option
- Take it when running instead of removing `RegisteredSystem`

This prevents a flush of the global command buffer and also enables
running one-shot systems without changing the shape of entities (opening
up DeferredWorld scenarios).

## Testing

- Tested the repro in #22380
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 C-Bug An unexpected or incorrect behavior 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.

Registered systems that unregister themselves panic

4 participants