diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp index 5b44594398..4a72afb16b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp @@ -63,6 +63,7 @@ #include #include #include +#include #include //////////////////////////////////////////////////////////////////////////// @@ -1409,6 +1410,16 @@ namespace AzToolsFramework { (void)name; QueueEntityUpdate(entityId); + + bool isSelected = false; + AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult( + isSelected, &AzToolsFramework::ToolsApplicationRequests::IsSelected, entityId); + + if (isSelected) + { + // Ask the system to scroll to the entity in case it is off screen after the rename + EntityOutlinerModelNotificationBus::Broadcast(&EntityOutlinerModelNotifications::QueueScrollToNewContent, entityId); + } } void EntityOutlinerListModel::OnEntityInfoUpdatedUnsavedChanges(AZ::EntityId entityId) diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp index ac9b92adce..11c279c7f7 100644 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp +++ b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp @@ -65,6 +65,7 @@ #include "OutlinerTreeView.hxx" #include "Include/ICommandManager.h" #include "Include/IObjectManager.h" +#include "OutlinerCacheBus.h" #include #include @@ -1538,6 +1539,16 @@ void OutlinerListModel::OnEntityInfoUpdatedName(AZ::EntityId entityId, const AZS { (void)name; QueueEntityUpdate(entityId); + + bool isSelected = false; + AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult( + isSelected, &AzToolsFramework::ToolsApplicationRequests::IsSelected, entityId); + + if (isSelected) + { + // Ask the system to scroll to the entity in case it is off screen after the rename + OutlinerModelNotificationBus::Broadcast(&OutlinerModelNotifications::QueueScrollToNewContent, entityId); + } } void OutlinerListModel::OnEntityInfoUpdatedUnsavedChanges(AZ::EntityId entityId)