From a2b7f90a78e9eb55a0ee93049dc94a06535634a9 Mon Sep 17 00:00:00 2001 From: Olex Lozitskiy <5432499+AMZN-Olex@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:26:52 -0500 Subject: [PATCH 1/2] Disabling problematic NetBindComponent assert with a configuration option. Signed-off-by: Olex Lozitskiy <5432499+AMZN-Olex@users.noreply.github.com> --- .../Code/Source/Components/NetBindComponent.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp b/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp index beb17ed9f6..d29e09881c 100644 --- a/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp @@ -22,6 +22,9 @@ #include #include +AZ_CVAR(bool, bg_AssertNetBindOnDeactrivationWithoutMarkForRemoval, false, nullptr, AZ::ConsoleFunctorFlags::Null, + "If true, assert when a multiplayer entity is deactivated without first calling MarkForRemoval from NetworkEntityManager."); + namespace Multiplayer { void NetBindComponent::Reflect(AZ::ReflectContext* context) @@ -167,10 +170,13 @@ namespace Multiplayer void NetBindComponent::Deactivate() { - AZ_Assert( - m_needsToBeStopped == false, - "Entity (%s) appears to have been improperly deleted. Use MarkForRemoval to correctly clean up a networked entity.", - GetEntity() ? GetEntity()->GetName().c_str() : "null"); + if (bg_AssertNetBindOnDeactrivationWithoutMarkForRemoval) + { + AZ_Assert( + m_needsToBeStopped == false, + "Entity (%s) appears to have been improperly deleted. Use MarkForRemoval to correctly clean up a networked entity.", + GetEntity() ? GetEntity()->GetName().c_str() : "null"); + } m_handleLocalServerRpcMessageEventHandle.Disconnect(); if (NetworkRoleHasController(m_netEntityRole)) { From 398f75d8cdb0d69baa289ad975462b70089567d2 Mon Sep 17 00:00:00 2001 From: Olex Lozitskiy <5432499+AMZN-Olex@users.noreply.github.com> Date: Fri, 11 Feb 2022 15:54:17 -0500 Subject: [PATCH 2/2] Spelling Signed-off-by: Olex Lozitskiy <5432499+AMZN-Olex@users.noreply.github.com> --- Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp b/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp index d29e09881c..c53019a150 100644 --- a/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/NetBindComponent.cpp @@ -22,7 +22,7 @@ #include #include -AZ_CVAR(bool, bg_AssertNetBindOnDeactrivationWithoutMarkForRemoval, false, nullptr, AZ::ConsoleFunctorFlags::Null, +AZ_CVAR(bool, bg_AssertNetBindOnDeactivationWithoutMarkForRemoval, false, nullptr, AZ::ConsoleFunctorFlags::Null, "If true, assert when a multiplayer entity is deactivated without first calling MarkForRemoval from NetworkEntityManager."); namespace Multiplayer @@ -170,7 +170,7 @@ namespace Multiplayer void NetBindComponent::Deactivate() { - if (bg_AssertNetBindOnDeactrivationWithoutMarkForRemoval) + if (bg_AssertNetBindOnDeactivationWithoutMarkForRemoval) { AZ_Assert( m_needsToBeStopped == false,