Added ReadyForEntityUpdates message allowing the server to send entity updates
This commit is contained in:
@@ -11,19 +11,19 @@
|
||||
*/
|
||||
|
||||
#include <Source/NetworkEntity/NetworkEntityManager.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Include/IMultiplayer.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Slice/SliceMetadataInfoComponent.h>
|
||||
#include <AzFramework/Components/TransformComponent.h>
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Entity/GameEntityContextBus.h>
|
||||
#include <AzFramework/Components/TransformComponent.h>
|
||||
#include <Include/IMultiplayer.h>
|
||||
#include <Pipeline/NetworkSpawnableHolderComponent.h>
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
@@ -462,7 +462,9 @@ namespace Multiplayer
|
||||
|
||||
m_rootSpawnableAsset = netSpawnableAsset;
|
||||
|
||||
const auto agentType = AZ::Interface<IMultiplayer>::Get()->GetAgentType();
|
||||
auto* iMultiplayer = AZ::Interface<IMultiplayer>::Get();
|
||||
|
||||
const auto agentType = iMultiplayer->GetAgentType();
|
||||
const bool spawnImmediately =
|
||||
(agentType == MultiplayerAgentType::ClientServer || agentType == MultiplayerAgentType::DedicatedServer);
|
||||
|
||||
@@ -470,6 +472,12 @@ namespace Multiplayer
|
||||
{
|
||||
CreateEntitiesImmediate(*netSpawnable, NetEntityRole::Authority);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we don't spawn net entities immediately (i.e. it is a client),
|
||||
// tell the server/host it can start sending updates that will instantiate entities.
|
||||
iMultiplayer->SendReadyForEntityUpdates(true);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkEntityManager::OnRootSpawnableReleased([[maybe_unused]] uint32_t generation)
|
||||
|
||||
Reference in New Issue
Block a user