Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gizmos app new panic #11420

Merged
merged 5 commits into from
Jan 19, 2024
Merged

Conversation

pablo-lua
Copy link
Contributor

Objective

After the Gizmos changes, App::init_gizmos_group turned into a important function that for sure mustn't panic. The problem is: the actual implementation causes a panic if somehow the code is runned before GizmoPlugin was added to the App

  • The error occurs here for example:
fn main() {
    App::new()
        .init_gizmo_group::<MyGizmoConfig>()
        .add_plugins(DefaultPlugins)
        .run();
}

#[derive(Default, Reflect, GizmoConfigGroup)]
struct MyGizmoConfig;

image

Solution

  • Instead of panicking when getting GizmoConfigStore, insert the store in App::init_gizmos_group if needed

Changelog

Changed

  • Changed App::init_gizmos_group to insert the resource if it don't exist

Removed

  • Removed explicit init of GizmoConfigStore

@pablo-lua
Copy link
Contributor Author

pablo-lua commented Jan 19, 2024

I'm very confused about this CI error, didn't mess with bevy_ecs here 🤔

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Gizmos Visual editor and debug gizmos labels Jan 19, 2024
@alice-i-cecile alice-i-cecile added this to the 0.13 milestone Jan 19, 2024
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 19, 2024
@alice-i-cecile
Copy link
Member

Merging as trivial <3

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 19, 2024
Merged via the queue into bevyengine:main with commit 6fbd585 Jan 19, 2024
22 checks passed
@pablo-lua pablo-lua deleted the fix-gizmos-panic branch January 19, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Gizmos Visual editor and debug gizmos 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.

3 participants