bevy/crates/bevy_gizmos
pablo-lua 6fbd585d78
Fix gizmos app new panic (#11420)
# 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:
```rust
fn main() {
    App::new()
        .init_gizmo_group::<MyGizmoConfig>()
        .add_plugins(DefaultPlugins)
        .run();
}

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

![image](https://github.com/bevyengine/bevy/assets/126117294/35e75608-0946-4320-8035-00a82562e37e)


## 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`

---------

Co-authored-by: François <mockersf@gmail.com>
2024-01-19 06:03:27 +00:00
..
macros Multiple Configurations for Gizmos (#10342) 2024-01-18 15:52:50 +00:00
src Fix gizmos app new panic (#11420) 2024-01-19 06:03:27 +00:00
Cargo.toml Multiple Configurations for Gizmos (#10342) 2024-01-18 15:52:50 +00:00