From 824be567fcab3c053cb701745dca1e8e94178d28 Mon Sep 17 00:00:00 2001 From: sconel Date: Thu, 27 May 2021 10:45:47 -0700 Subject: [PATCH] Prepping for PR --- .../ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp | 11 ++++------- .../ScriptCanvas/Libraries/Spawning/SpawnNodeable.h | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp index 93a248de5d..28d9af9bcd 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp @@ -22,10 +22,6 @@ namespace ScriptCanvas { namespace Spawning { - SpawnNodeable::SpawnNodeable() - { - } - SpawnNodeable::SpawnNodeable(const SpawnNodeable& rhs) { m_spawnableAsset = rhs.m_spawnableAsset; @@ -38,7 +34,6 @@ namespace ScriptCanvas AZ::TickBus::Handler::BusConnect(); } - m_spawnTicket.IsValid(); m_spawnTicket = AzFramework::EntitySpawnTicket(m_spawnableAsset); } @@ -57,7 +52,7 @@ namespace ScriptCanvas AZStd::vector swappedSpawnedEntityList; AZStd::vector swappedSpawnBatchSizes; { - AZStd::lock_guard lock(m_recursiveMutex); + AZStd::lock_guard lock(m_idBatchMutex); swappedSpawnedEntityList.swap(m_spawnedEntityList); swappedSpawnBatchSizes.swap(m_spawnBatchSizes); @@ -99,6 +94,8 @@ namespace ScriptCanvas m_spawnableAsset = AZ::Data::AssetManager::Instance(). FindOrCreateAsset(rootAssetId, AZ::Data::AssetLoadBehavior::Default); } + + m_spawnableAsset.SetAutoLoadBehavior(AZ::Data::AssetLoadBehavior::PreLoad); } } @@ -129,7 +126,7 @@ namespace ScriptCanvas auto spawnCompleteCB = [this]([[maybe_unused]] AzFramework::EntitySpawnTicket& ticket, AzFramework::SpawnableConstEntityContainerView view) { - AZStd::lock_guard lock(m_recursiveMutex); + AZStd::lock_guard lock(m_idBatchMutex); m_spawnedEntityList.reserve(m_spawnedEntityList.size() + view.size()); for (const AZ::Entity* entity : view) { diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.h index 25cb92742e..2b2a22601d 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.h @@ -34,7 +34,7 @@ namespace ScriptCanvas { SCRIPTCANVAS_NODE(SpawnNodeable); public: - SpawnNodeable(); + SpawnNodeable() = default; SpawnNodeable(const SpawnNodeable& rhs); void OnInitializeExecutionState() override; @@ -50,7 +50,7 @@ namespace ScriptCanvas AZStd::vector m_spawnedEntityList; AZStd::vector m_spawnBatchSizes; - AZStd::recursive_mutex m_recursiveMutex; + AZStd::recursive_mutex m_idBatchMutex; }; } }