diff --git a/Source/Editor/Viewport/MainEditorGizmoViewport.cs b/Source/Editor/Viewport/MainEditorGizmoViewport.cs index 88f59b0c9..e106aeec2 100644 --- a/Source/Editor/Viewport/MainEditorGizmoViewport.cs +++ b/Source/Editor/Viewport/MainEditorGizmoViewport.cs @@ -342,7 +342,7 @@ namespace FlaxEditor.Viewport { UICanvas canvas = null; var controlParent = control.Parent; - while (controlParent != null || controlParent is not Scene) + while (controlParent != null && controlParent is not Scene) { if (controlParent is UICanvas uiCanvas) { @@ -355,11 +355,14 @@ namespace FlaxEditor.Viewport if (canvas != null) { if (canvas.Is2D) - { continue; - } } } + else if (a is UICanvas uiCanvas) + { + if (uiCanvas.Is2D) + continue; + } // Check if all corners are in box to select it. var corners = actorBox.GetCorners();