Skip to content

Commit

Permalink
Avoid processing freecam input movement when there is a focused input…
Browse files Browse the repository at this point in the history
… field.
  • Loading branch information
originalnicodr committed Dec 16, 2024
1 parent b03d810 commit 6111c17
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/UI/Panels/FreeCamPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -868,6 +868,20 @@ internal void Update()
}
}

private bool IsInputFieldInFocus()
{
GameObject currentObject = EventSystemHelper.CurrentEventSystem.currentSelectedGameObject;
if (currentObject != null)
{
UnityEngine.UI.InputField selectedInputField = currentObject.GetComponent<UnityEngine.UI.InputField>();
if (selectedInputField != null)
{
return selectedInputField.isFocused;
}
}
return false;
}

private void OnPreCull()
{
UpdateRelativeMatrix();
Expand Down

0 comments on commit 6111c17

Please sign in to comment.