0
Fixed
SceneMouseNavigation.LateUpdate uses FindObjectsByType<TMP_InputField> every frame → catastrophic global scan on large scenes
Ramon Janousch 1 day ago
in realvirtual.io Starter and Professional
•
updated by Support 1 day ago •
2
LateUpdate in SceneMouseNavigation calls CheckForFocusedFields which uses FindObjectsByType.
On large scenes, this per-frame global lookup produces unacceptable frame times.
FindObjectsByType should not be called every frame.
This is the profiler result with 4000 active and 400.000 inactive objects in the scene:

Same scene with an early return in CheckForFocusedFields.


Environment:
- Unity 6000.2.10f1
- realvirtual-Professional-6.2.1
- Windows 10 x64
- RAM 32 GB
- CPU Intel Xeon W-11955M @2.6 GHz (8 Cores)
Customer support service by UserEcho
Thanks for reporting - we are checking for a solution - maybe caching it and will let you know.
Hi, thanks for reporting and finding the issue.
Please relace the method by this:
//! Check if any UI input field has focus - uses EventSystem for O(1) performance
private bool CheckForFocusedFields()
{
// Check if currently selected GameObject is a TMP_InputField (O(1) performance)
var selectedObject = EventSystem.current?.currentSelectedGameObject;
if (selectedObject != null)
{
var inputField = selectedObject.GetComponent();
if (inputField != null && inputField.isFocused)
return true;
}
// Check UI Toolkit focus controller
if (focusController != null && focusController.focusedElement is TextField)
return true;
return false;
}
We will inlclude this in the next update.