Externed cvars dont get registered with setreg (not sure why). Updating sv_defaultPlayer to grab the variable via console string lookup instead so the proper value is gathered

Signed-off-by: Gene Walters <genewalt@amazon.com>
This commit is contained in:
Gene Walters
2021-11-10 19:37:11 -08:00
parent 5d5087e0d3
commit d6803d800b
2 changed files with 14 additions and 4 deletions
@@ -219,12 +219,22 @@ namespace Multiplayer
{
server_rhi = static_cast<AZ::CVarFixedString>(editorsv_rhi_override);
}
const auto console = AZ::Interface<AZ::IConsole>::Get();
AZ::CVarFixedString sv_defaultPlayerSpawnAsset;
if (console->GetCvarValue("sv_defaultPlayerSpawnAsset", sv_defaultPlayerSpawnAsset) != AZ::GetValueResult::Success)
{
AZ_Assert( false,
"MultiplayerEditorSystemComponent::LaunchEditorServer failed! Could not find the sv_defaultPlayerSpawnAsset cvar; the editor-server "
"will fall back to using some other default player! Please update this code to use a valid cvar!")
}
processLaunchInfo.m_commandlineParameters = AZStd::string::format(
R"("%s" --project-path "%s" --editorsv_isDedicated true --sv_defaultPlayerSpawnAsset "%s" --rhi "%s")",
serverPath.c_str(),
AZ::Utils::GetProjectPath().c_str(),
static_cast<AZ::CVarFixedString>(sv_defaultPlayerSpawnAsset).c_str(),
sv_defaultPlayerSpawnAsset.c_str(),
server_rhi.GetCStr()
);
processLaunchInfo.m_showWindow = true;
@@ -292,7 +302,9 @@ namespace Multiplayer
editorNetworkInterface->Listen(editorsv_port);
// Launch the editor-server
m_serverProcess = LaunchEditorServer();
m_serverProcessWatcher = LaunchEditorServer();
m_serverProcessTracePrinter = AZStd::make_unique<ProcessCommunicatorTracePrinter>(m_serverProcessWatcher->GetCommunicator(), "EditorServer");
AZ::TickBus::Handler::BusConnect();
}
else
{
@@ -37,8 +37,6 @@ namespace AzNetworking
namespace Multiplayer
{
AZ_CVAR_EXTERNED(AZ::CVarFixedString, sv_defaultPlayerSpawnAsset);
//! Multiplayer system component wraps the bridging logic between the game and transport layer.
class MultiplayerSystemComponent final
: public AZ::Component