From 39a10cc7dd48c663934e34b166ca9b57ddbf457e Mon Sep 17 00:00:00 2001 From: Sergey Pereslavtsev Date: Thu, 5 Jan 2023 13:45:40 +0000 Subject: [PATCH 1/2] Set actor instance thread index in the animation component Signed-off-by: Sergey Pereslavtsev --- Gem/Code/Source/Components/NetworkAnimationComponent.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gem/Code/Source/Components/NetworkAnimationComponent.cpp b/Gem/Code/Source/Components/NetworkAnimationComponent.cpp index fc7028f89..92079984f 100644 --- a/Gem/Code/Source/Components/NetworkAnimationComponent.cpp +++ b/Gem/Code/Source/Components/NetworkAnimationComponent.cpp @@ -13,6 +13,8 @@ #include #include #include +#include +#include namespace MultiplayerSample { @@ -96,6 +98,10 @@ namespace MultiplayerSample constexpr bool isAuthoritative = true; m_networkRequests->CreateSnapshot(isAuthoritative); } + + const AZ::u32 threadIndex = AZ::JobContext::GetGlobalContext()->GetJobManager().GetWorkerThreadId(); + m_networkRequests->SetActorThreadIndex(threadIndex); + m_networkRequests->UpdateActorExternal(deltaTime); if (m_velocityParamId == InvalidParamIndex) From 1099abba5812e000b87764e8e3feab4270c8101e Mon Sep 17 00:00:00 2001 From: Sergey Pereslavtsev Date: Fri, 13 Jan 2023 12:35:26 +0000 Subject: [PATCH 2/2] Fix for non-threaded processing Signed-off-by: Sergey Pereslavtsev --- Gem/Code/Source/Components/NetworkAnimationComponent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gem/Code/Source/Components/NetworkAnimationComponent.cpp b/Gem/Code/Source/Components/NetworkAnimationComponent.cpp index 92079984f..035777939 100644 --- a/Gem/Code/Source/Components/NetworkAnimationComponent.cpp +++ b/Gem/Code/Source/Components/NetworkAnimationComponent.cpp @@ -100,7 +100,10 @@ namespace MultiplayerSample } const AZ::u32 threadIndex = AZ::JobContext::GetGlobalContext()->GetJobManager().GetWorkerThreadId(); - m_networkRequests->SetActorThreadIndex(threadIndex); + if (threadIndex != AZ::JobManager::InvalidWorkerThreadId) + { + m_networkRequests->SetActorThreadIndex(threadIndex); + } m_networkRequests->UpdateActorExternal(deltaTime);