From eaa5716d6a7c27756de03e519f872c2fa28c39c0 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 29 Apr 2021 16:17:40 +0200 Subject: [PATCH] Fix editor viewport input when using ScreenSpace canvas in a prefab --- Source/Editor/Viewport/EditorViewport.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs index a1e2df86c..25fcbe4ce 100644 --- a/Source/Editor/Viewport/EditorViewport.cs +++ b/Source/Editor/Viewport/EditorViewport.cs @@ -974,7 +974,8 @@ namespace FlaxEditor.Viewport // Get input buttons and keys (skip if viewport has no focus or mouse is over a child control) bool useMouse = Mathf.IsInRange(_viewMousePos.X, 0, Width) && Mathf.IsInRange(_viewMousePos.Y, 0, Height); _prevInput = _input; - if (ContainsFocus && GetChildAt(_viewMousePos, c => c.Visible) == null) + var hit = GetChildAt(_viewMousePos, c => c.Visible && !(c is CanvasRootControl)); + if (ContainsFocus && hit == null) _input.Gather(win.Window, useMouse); else _input.Clear();