mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 14:08:32 +00:00
Overwrite gizmo group in insert_gizmo_group
(#11860)
# Objective I tried using `insert_gizmo_group` to configure my physics gizmos in a bevy_xpbd example, but was surprised to see that nothing happened. I found out that the method does *not* overwrite gizmo groups that have already been initialized (with `init_gizmo_group`). This is unexpected, since methods like `insert_resource` *do* overwrite. ## Solution Insert the configuration even if it has already been initialized.
This commit is contained in:
parent
0354ce4450
commit
8cf3447343
1 changed files with 4 additions and 4 deletions
|
@ -183,6 +183,10 @@ impl AppGizmoBuilder for App {
|
|||
group: T,
|
||||
config: GizmoConfig,
|
||||
) -> &mut Self {
|
||||
self.world
|
||||
.get_resource_or_insert_with::<GizmoConfigStore>(Default::default)
|
||||
.insert(config, group);
|
||||
|
||||
if self.world.contains_resource::<GizmoStorage<T>>() {
|
||||
return self;
|
||||
}
|
||||
|
@ -190,10 +194,6 @@ impl AppGizmoBuilder for App {
|
|||
self.init_resource::<GizmoStorage<T>>()
|
||||
.add_systems(Last, update_gizmo_meshes::<T>);
|
||||
|
||||
self.world
|
||||
.get_resource_or_insert_with::<GizmoConfigStore>(Default::default)
|
||||
.insert(config, group);
|
||||
|
||||
let Ok(render_app) = self.get_sub_app_mut(RenderApp) else {
|
||||
return self;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue