From 6111c1743b3a1c764c42bf8a396128493bb0cad6 Mon Sep 17 00:00:00 2001 From: originalnicodr Date: Sun, 15 Dec 2024 21:13:20 -0300 Subject: [PATCH] Avoid processing freecam input movement when there is a focused input field. --- src/UI/Panels/FreeCamPanel.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/UI/Panels/FreeCamPanel.cs b/src/UI/Panels/FreeCamPanel.cs index 17b85045..54fcec21 100644 --- a/src/UI/Panels/FreeCamPanel.cs +++ b/src/UI/Panels/FreeCamPanel.cs @@ -834,7 +834,7 @@ internal void Update() } Transform movingTransform = FreeCamPanel.GetFreecam().transform; - if (!FreeCamPanel.blockFreecamMovementToggle.isOn && !FreeCamPanel.cameraPathMover.playingPath && FreeCamPanel.connector?.IsActive != true) { + if (!FreeCamPanel.blockFreecamMovementToggle.isOn && !FreeCamPanel.cameraPathMover.playingPath && FreeCamPanel.connector?.IsActive != true && !IsInputFieldInFocus()) { ProcessInput(movingTransform); } @@ -868,6 +868,20 @@ internal void Update() } } + private bool IsInputFieldInFocus() + { + GameObject currentObject = EventSystemHelper.CurrentEventSystem.currentSelectedGameObject; + if (currentObject != null) + { + UnityEngine.UI.InputField selectedInputField = currentObject.GetComponent(); + if (selectedInputField != null) + { + return selectedInputField.isFocused; + } + } + return false; + } + private void OnPreCull() { UpdateRelativeMatrix();