diff --git a/Source/Editor/GUI/Popups/RenamePopup.cs b/Source/Editor/GUI/Popups/RenamePopup.cs
index 353830a21..d17a4180d 100644
--- a/Source/Editor/GUI/Popups/RenamePopup.cs
+++ b/Source/Editor/GUI/Popups/RenamePopup.cs
@@ -130,6 +130,10 @@ namespace FlaxEditor.GUI
/// Created popup.
public static RenamePopup Show(Control control, Rectangle area, string value, bool isMultiline)
{
+ // hardcoded flushing layout for tree controls
+ if (control is Tree.TreeNode treeNode && treeNode.ParentTree != null)
+ treeNode.ParentTree.FlushPendingPerformLayout();
+
// Calculate the control size in the window space to handle scaled controls
var upperLeft = control.PointToWindow(area.UpperLeft);
var bottomRight = control.PointToWindow(area.BottomRight);
diff --git a/Source/Editor/GUI/Tree/Tree.cs b/Source/Editor/GUI/Tree/Tree.cs
index 8df26c211..facc2c36d 100644
--- a/Source/Editor/GUI/Tree/Tree.cs
+++ b/Source/Editor/GUI/Tree/Tree.cs
@@ -364,6 +364,19 @@ namespace FlaxEditor.GUI.Tree
BulkSelectUpdateExpanded(false);
}
+ ///
+ /// Flushes any pending layout perming action that has been delayed until next update to optimize performance of the complex tree hierarchy.
+ ///
+ public void FlushPendingPerformLayout()
+ {
+ if (_deferLayoutUpdate)
+ {
+ base.PerformLayout();
+ AfterDeferredLayout?.Invoke();
+ _deferLayoutUpdate = false;
+ }
+ }
+
///
public override void PerformLayout(bool force = false)
{
@@ -378,11 +391,7 @@ namespace FlaxEditor.GUI.Tree
public override void Update(float deltaTime)
{
if (_deferLayoutUpdate)
- {
- base.PerformLayout();
- AfterDeferredLayout?.Invoke();
- _deferLayoutUpdate = false;
- }
+ FlushPendingPerformLayout();
var node = SelectedNode;