Skip to content

Window despawns before PostUpdate #11874

@doonv

Description

@doonv

Bevy version

main (1d5388e)

What you did

Create a system that queries for Window in the PostUpdate schedule.

What went wrong

This line right here in WindowPlugin:

app.add_systems(Update, close_when_requested);

The system that despawns the window entity runs during the Update schedule, this means there could be a situation where the window entity does not exist during the PostUpdate schedule. This happened to me and it caused a panic.

Additional information

This could be solved by putting the close_when_requested system in the Last or PostUpdate schedules instead. I don't know which is better though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WindowingPlatform-agnostic interface layer to run your app inC-BugAn unexpected or incorrect behaviorC-Code-QualityA section of code that is hard to understand or changeD-ComplexQuite challenging from either a design or technical perspective. Ask for help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions