diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/ReadOnly/ReadOnlyEntitySystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/ReadOnly/ReadOnlyEntitySystemComponent.cpp index f7f36177c9..7536e1e8a5 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/ReadOnly/ReadOnlyEntitySystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/ReadOnly/ReadOnlyEntitySystemComponent.cpp @@ -52,7 +52,7 @@ namespace AzToolsFramework void ReadOnlyEntitySystemComponent::RefreshReadOnlyState(const EntityIdList& entityIds) { - for (const AZ::EntityId entityId : entityIds) + for (const AZ::EntityId& entityId : entityIds) { bool wasReadOnly = m_readOnlystates[entityId]; QueryReadOnlyStateForEntity(entityId); @@ -67,10 +67,10 @@ namespace AzToolsFramework void ReadOnlyEntitySystemComponent::RefreshReadOnlyStateForAllEntities() { - for (auto elem : m_readOnlystates) + for (auto& elem : m_readOnlystates) { AZ::EntityId entityId = elem.first; - bool wasReadOnly = m_readOnlystates[entityId]; + bool wasReadOnly = elem.second; QueryReadOnlyStateForEntity(entityId); if (bool isReadOnly = m_readOnlystates[entityId]; wasReadOnly != isReadOnly)