Fix EditorServer connection by ensuring that SendReadyForEntityUpdates is only called after a handshake is finished and the editor has accepted the editorserver's connection. Also allow engine-centric projects to use editor-server by passing in the project-path when launching the editor-server. Also allow devs to set sv_defaultPlayerSpawnAsset from inside the editor and it'll be used by the editor-server
Signed-off-by: Gene Walters <genewalt@amazon.com>
This commit is contained in:
@@ -489,11 +489,23 @@ namespace Multiplayer
|
||||
{
|
||||
m_didHandshake = true;
|
||||
|
||||
AZ::CVarFixedString commandString = "sv_map " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(commandString.c_str());
|
||||
// If this is an Editor then we're now accepting the connection to the EditorServer.
|
||||
// In normal game clients SendReadyForEntityUpdates will be enabled once the appropriate level's root spawnable is loaded,
|
||||
// but since we're in Editor, we're already in the level.
|
||||
AZ::ApplicationTypeQuery applicationType;
|
||||
AZ::ComponentApplicationBus::Broadcast(&AZ::ComponentApplicationRequests::QueryApplicationType, applicationType);
|
||||
if (applicationType.IsEditor())
|
||||
{
|
||||
SendReadyForEntityUpdates(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::CVarFixedString commandString = "sv_map " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(commandString.c_str());
|
||||
|
||||
AZ::CVarFixedString loadLevelString = "LoadLevel " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(loadLevelString.c_str());
|
||||
AZ::CVarFixedString loadLevelString = "LoadLevel " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(loadLevelString.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -981,7 +993,7 @@ namespace Multiplayer
|
||||
INetworkEntityManager::EntityList entityList = m_networkEntityManager.CreateEntitiesImmediate(playerPrefabEntityId, NetEntityRole::Authority, AZ::Transform::CreateIdentity(), Multiplayer::AutoActivate::DoNotActivate);
|
||||
|
||||
NetworkEntityHandle controlledEntity;
|
||||
if (entityList.size() > 0)
|
||||
if (!entityList.empty())
|
||||
{
|
||||
controlledEntity = entityList[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user