Fix for unit test. Checking that AssetManager is ready before spawning entities; MultiplayerSystemComponent will attempt to spawn a default player on init(), but during unit tests the AssetManager isn't stood up

This commit is contained in:
Gene Walters
2021-05-27 22:29:40 -07:00
parent 98d9ee44fd
commit 0f258954fb
@@ -402,8 +402,12 @@ namespace Multiplayer
const AZ::Transform& transform
)
{
INetworkEntityManager::EntityList returnList;
EntityList returnList;
if (!AZ::Data::AssetManager::IsReady())
{
return returnList;
}
auto spawnableAssetId = m_networkPrefabLibrary.GetAssetIdByName(prefabEntryId.m_prefabName);
// Required for sync-instantiation. Todo: keep the reference in NetworkSpawnableLibrary
auto netSpawnableAsset = AZ::Data::AssetManager::Instance().GetAsset<AzFramework::Spawnable>(spawnableAssetId, AZ::Data::AssetLoadBehavior::PreLoad);