Avoid panicking with non-UI nodes (#12213)
# Objective - Fixes https://github.com/bevyengine/bevy/issues/10826 - Fixes https://github.com/bevyengine/bevy/issues/9615 ## Solution - Early-out when components are missing.
This commit is contained in:
parent
8234978ab0
commit
b8c58dedd9
@ -411,7 +411,9 @@ pub fn ui_layout_system(
|
|||||||
mut absolute_location: Vec2,
|
mut absolute_location: Vec2,
|
||||||
) {
|
) {
|
||||||
if let Ok((mut node, mut transform)) = node_transform_query.get_mut(entity) {
|
if let Ok((mut node, mut transform)) = node_transform_query.get_mut(entity) {
|
||||||
let layout = ui_surface.get_layout(entity).unwrap();
|
let Ok(layout) = ui_surface.get_layout(entity) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
let layout_size =
|
let layout_size =
|
||||||
inverse_target_scale_factor * Vec2::new(layout.size.width, layout.size.height);
|
inverse_target_scale_factor * Vec2::new(layout.size.width, layout.size.height);
|
||||||
let layout_location =
|
let layout_location =
|
||||||
|
@ -155,7 +155,9 @@ fn update_children_target_camera(
|
|||||||
|
|
||||||
for &child in children {
|
for &child in children {
|
||||||
// Skip if the child has already been updated or update is not needed
|
// Skip if the child has already been updated or update is not needed
|
||||||
if updated_entities.contains(&child) || camera_to_set == node_query.get(child).unwrap() {
|
if updated_entities.contains(&child)
|
||||||
|
|| camera_to_set == node_query.get(child).ok().flatten()
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user