@ -25,6 +25,8 @@
# include <Multiplayer/Components/NetworkHierarchyRootComponent.h>
# include <Multiplayer/Components/NetworkHierarchyRootComponent.h>
# include <Pipeline/NetworkSpawnableHolderComponent.h>
# include <Pipeline/NetworkSpawnableHolderComponent.h>
AZ_DECLARE_BUDGET ( MULTIPLAYER ) ;
namespace Multiplayer
namespace Multiplayer
{
{
AZ_CVAR ( bool , net_DebugCheckNetworkEntityManager , false , nullptr , AZ : : ConsoleFunctorFlags : : Null , " Enables extra debug checks inside the NetworkEntityManager " ) ;
AZ_CVAR ( bool , net_DebugCheckNetworkEntityManager , false , nullptr , AZ : : ConsoleFunctorFlags : : Null , " Enables extra debug checks inside the NetworkEntityManager " ) ;
@ -203,11 +205,13 @@ namespace Multiplayer
void NetworkEntityManager : : NotifyEntitiesDirtied ( )
void NetworkEntityManager : : NotifyEntitiesDirtied ( )
{
{
AZ_PROFILE_SCOPE ( MULTIPLAYER , " NetworkEntityManager: NotifyEntitiesDirtied " ) ;
m_onEntityMarkedDirty . Signal ( ) ;
m_onEntityMarkedDirty . Signal ( ) ;
}
}
void NetworkEntityManager : : NotifyEntitiesChanged ( )
void NetworkEntityManager : : NotifyEntitiesChanged ( )
{
{
AZ_PROFILE_SCOPE ( MULTIPLAYER , " NetworkEntityManager: NotifyEntitiesChanged " ) ;
m_onEntityNotifyChanges . Signal ( ) ;
m_onEntityNotifyChanges . Signal ( ) ;
}
}
@ -360,7 +364,7 @@ namespace Multiplayer
m_networkEntityTracker . erase ( entityId ) ;
m_networkEntityTracker . erase ( entityId ) ;
}
}
}
}
INetworkEntityManager : : EntityList NetworkEntityManager : : CreateEntitiesImmediate (
INetworkEntityManager : : EntityList NetworkEntityManager : : CreateEntitiesImmediate (
const AzFramework : : Spawnable & spawnable , NetEntityRole netEntityRole , AutoActivate autoActivate )
const AzFramework : : Spawnable & spawnable , NetEntityRole netEntityRole , AutoActivate autoActivate )
{
{
@ -457,12 +461,12 @@ namespace Multiplayer
{
{
return returnList ;
return returnList ;
}
}
auto spawnableAssetId = m_networkPrefabLibrary . GetAssetIdByName ( prefabEntryId . m_prefabName ) ;
auto spawnableAssetId = m_networkPrefabLibrary . GetAssetIdByName ( prefabEntryId . m_prefabName ) ;
// Required for sync-instantiation. Todo: keep the reference in NetworkSpawnableLibrary
// Required for sync-instantiation. Todo: keep the reference in NetworkSpawnableLibrary
auto netSpawnableAsset = AZ : : Data : : AssetManager : : Instance ( ) . GetAsset < AzFramework : : Spawnable > ( spawnableAssetId , AZ : : Data : : AssetLoadBehavior : : PreLoad ) ;
auto netSpawnableAsset = AZ : : Data : : AssetManager : : Instance ( ) . GetAsset < AzFramework : : Spawnable > ( spawnableAssetId , AZ : : Data : : AssetLoadBehavior : : PreLoad ) ;
AZ : : Data : : AssetManager : : Instance ( ) . BlockUntilLoadComplete ( netSpawnableAsset ) ;
AZ : : Data : : AssetManager : : Instance ( ) . BlockUntilLoadComplete ( netSpawnableAsset ) ;
AzFramework : : Spawnable * netSpawnable = netSpawnableAsset . GetAs < AzFramework : : Spawnable > ( ) ;
AzFramework : : Spawnable * netSpawnable = netSpawnableAsset . GetAs < AzFramework : : Spawnable > ( ) ;
if ( ! netSpawnable )
if ( ! netSpawnable )
{
{
@ -619,7 +623,7 @@ namespace Multiplayer
NetworkHierarchyRootComponentController * hierarchyRootController = entityHandle . FindController < NetworkHierarchyRootComponentController > ( ) ;
NetworkHierarchyRootComponentController * hierarchyRootController = entityHandle . FindController < NetworkHierarchyRootComponentController > ( ) ;
NetworkHierarchyChildComponentController * hierarchyChildController = entityHandle . FindController < NetworkHierarchyChildComponentController > ( ) ;
NetworkHierarchyChildComponentController * hierarchyChildController = entityHandle . FindController < NetworkHierarchyChildComponentController > ( ) ;
AZStd : : vector < AZ : : Entity * > hierarchicalEntities ;
AZStd : : vector < AZ : : Entity * > hierarchicalEntities ;
// Get the entities in this hierarchy
// Get the entities in this hierarchy
if ( hierarchyRootController )
if ( hierarchyRootController )