From 9e4a39f9ed5ea59481f49b4e8e3f09ed8440db8f Mon Sep 17 00:00:00 2001 From: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com> Date: Wed, 20 Oct 2021 09:30:21 -0400 Subject: [PATCH] Hierarchy code enhancements Signed-off-by: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com> --- .../Source/Components/NetworkHierarchyRootComponent.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Gems/Multiplayer/Code/Source/Components/NetworkHierarchyRootComponent.cpp b/Gems/Multiplayer/Code/Source/Components/NetworkHierarchyRootComponent.cpp index eeb61ef450..040792d132 100644 --- a/Gems/Multiplayer/Code/Source/Components/NetworkHierarchyRootComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/NetworkHierarchyRootComponent.cpp @@ -20,6 +20,8 @@ AZ_CVAR(uint32_t, bg_hierarchyEntityMaxLimit, 16, nullptr, AZ::ConsoleFunctorFlags::Null, "Maximum allowed size of network entity hierarchies, including top level entity."); +static constexpr int CommonHierarchyEntityMaxLimit = 16; // Should match @bg_hierarchyEntityMaxLimit + namespace Multiplayer { void NetworkHierarchyRootComponent::Reflect(AZ::ReflectContext* context) @@ -270,7 +272,7 @@ namespace Multiplayer { AZ::ComponentApplicationRequests* componentApplicationRequests = AZ::Interface::Get(); - AZStd::deque candidates; + AZStd::deque candidates; candidates.push_back(underEntity); while (!candidates.empty()) @@ -289,6 +291,9 @@ namespace Multiplayer if (m_hierarchicalEntities.size() >= bg_hierarchyEntityMaxLimit) { + AZLOG_WARN("Network hierarchy size exceeded, current limit is %d, root entity was %s", + static_cast(bg_hierarchyEntityMaxLimit), + GetEntity()->GetName().c_str()); return; }