ExtraArgs

ExtraArgs

#Overview

name: ExtraArgs

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 26 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ExtraArgs is to provide additional command-line arguments or configuration options for various subsystems and processes within Unreal Engine 5. It is used in multiple contexts across different modules and plugins to pass extra information or customize behavior.

ExtraArgs is utilized by several Unreal Engine subsystems, plugins, and modules, including:

  1. PCG (Procedural Content Generation) module
  2. DerivedDataCache system
  3. Zen server interface
  4. WorldPartitionEditor module
  5. LowLevelTestsRunner
  6. CommonUser plugin

The value of ExtraArgs is typically set programmatically within the code, often based on configuration files, user input, or specific requirements of the module or subsystem using it.

ExtraArgs frequently interacts with other variables and systems, such as command-line parsers, configuration readers, and specific module settings. It is often used in conjunction with other parameters to construct complete command lines or configuration sets.

Developers should be aware of the following when using ExtraArgs:

  1. The content of ExtraArgs can significantly affect the behavior of various systems.
  2. It’s important to sanitize and validate any user-provided input that goes into ExtraArgs to prevent security issues or unexpected behavior.
  3. The format and accepted values for ExtraArgs may vary depending on the specific subsystem or module using it.

Best practices for using ExtraArgs include:

  1. Document the purpose and expected format of ExtraArgs for each specific use case.
  2. Use clear and descriptive key names when adding key-value pairs to ExtraArgs.
  3. Implement proper error handling and validation when processing ExtraArgs.
  4. Keep ExtraArgs focused on its intended purpose and avoid overloading it with unrelated information.
  5. Consider using type-safe alternatives where possible, instead of relying on string-based ExtraArgs for critical functionality.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2442, section: [Zen.AutoLaunch]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/PCG/Source/PCGEditor/Private/WorldPartitionBuilder/PCGWorldPartitionBuilder.cpp:580

Scope (from outer to inner):

file
function     void PCGWorldPartitionBuilder::Build

Source code excerpt:

		Params.OperationDescription = FText::FromString("Generating PCG Components...");
		
		Params.ExtraArgs = TEXT("-AllowCommandletRendering");
		for (const FString& Arg : Args)
		{
			Params.ExtraArgs += " ";
			Params.ExtraArgs += Arg;
		}

		WorldPartitionEditorModule.RunBuilder(Params);
	}
}

#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:622

Scope (from outer to inner):

file
namespace    UE::DerivedData
function     bool FHttpCacheStoreTest::RunTest

Source code excerpt:

	FServiceAutoLaunchSettings& ZenUpstreamTestAutoLaunchSettings = ZenUpstreamTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
	ZenUpstreamTestAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUpstreamUnitTest"));
	ZenUpstreamTestAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-jupiter-url \"%s\" --upstream-jupiter-token \"%s\" --upstream-jupiter-namespace \"%s\""),
		*TestDomain,
		*TestAccessToken,
		*TestNamespace
	);
	ZenUpstreamTestAutoLaunchSettings.DesiredPort = 23337; // Avoid the normal default port
	ZenUpstreamTestAutoLaunchSettings.bShowConsole = true;

#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:636

Scope (from outer to inner):

file
namespace    UE::DerivedData
function     bool FHttpCacheStoreTest::RunTest

Source code excerpt:

	FServiceAutoLaunchSettings& ZenUpstreamSiblingTestAutoLaunchSettings = ZenUpstreamSiblingTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
	ZenUpstreamSiblingTestAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUpstreamSiblingUnitTest"));
	ZenUpstreamSiblingTestAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-jupiter-url \"%s\" --upstream-jupiter-token \"%s\" --upstream-jupiter-namespace \"%s\""),
		*TestDomain,
		*TestAccessToken,
		*TestNamespace
	);
	ZenUpstreamSiblingTestAutoLaunchSettings.DesiredPort = 23338; // Avoid the normal default port
	ZenUpstreamSiblingTestAutoLaunchSettings.bShowConsole = true;

#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:649

Scope (from outer to inner):

file
namespace    UE::DerivedData
function     bool FHttpCacheStoreTest::RunTest

Source code excerpt:

	FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
	ZenTestAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUnitTest"));
	ZenTestAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-zen-url \"http://localhost:%d\""),
		ScopeZenUpstreamService.GetInstance().GetPort()
	);
	ZenTestAutoLaunchSettings.DesiredPort = 13337; // Avoid the normal default port
	ZenTestAutoLaunchSettings.bShowConsole = true;
	ZenTestAutoLaunchSettings.bLimitProcessLifetime = true;

#Loc: <Workspace>/Engine/Source/Developer/DerivedDataCache/Private/Tests/HttpCacheStoreTest.cpp:660

Scope (from outer to inner):

file
namespace    UE::DerivedData
function     bool FHttpCacheStoreTest::RunTest

Source code excerpt:

	FServiceAutoLaunchSettings& ZenTestSiblingAutoLaunchSettings = ZenTestServiceSiblingSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
	ZenTestSiblingAutoLaunchSettings.DataPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EngineSavedDir(), "ZenUnitTestSibling"));
	ZenTestSiblingAutoLaunchSettings.ExtraArgs = FString::Printf(TEXT("--http asio --upstream-zen-url \"http://localhost:%d\""),
		ScopeZenUpstreamSiblingService.GetInstance().GetPort()
	);
	ZenTestSiblingAutoLaunchSettings.DesiredPort = 13338; // Avoid the normal default port
	ZenTestSiblingAutoLaunchSettings.bShowConsole = true;
	ZenTestSiblingAutoLaunchSettings.bLimitProcessLifetime = true;

#Loc: <Workspace>/Engine/Source/Developer/LowLevelTestsRunner/Private/TestRunner.cpp:71

Scope (from outer to inner):

file
namespace    UE::LowLevelTests
class        class FTestRunner final : public ITestRunner

Source code excerpt:

private:
	TArray<const ANSICHAR*> CatchArgs;
	FStringBuilderBase ExtraArgs;
	FTestRunnerOutputDeviceError ErrorOutputDevice;
	bool bGlobalSetup = true;
	bool bLogOutput = false;
	bool bDebugMode = false;
	bool bMultiThreaded = false;
	bool bWaitForInputToTerminate = false;

#Loc: <Workspace>/Engine/Source/Developer/LowLevelTestsRunner/Private/TestRunner.cpp:102

Scope (from outer to inner):

file
namespace    UE::LowLevelTests
function     void FTestRunner::ParseCommandLine

Source code excerpt:

				if (const int32 EqualIndex = String::FindFirstChar(Arg, '='); EqualIndex != INDEX_NONE && EqualIndex < SpaceIndex)
				{
					ExtraArgs.Append(Arg.Left(EqualIndex + 1));
					Arg.RightChopInline(EqualIndex + 1);
				}
				ExtraArgs.AppendChar('"').Append(Arg).AppendChar('"').AppendChar(' ');
			}
			else
			{
				ExtraArgs.Append(Arg).AppendChar(' ');
			}
		}
		else if (Arg == ANSITEXTVIEW("--extra-args"))
		{
			bExtraArg = true;
		}

#Loc: <Workspace>/Engine/Source/Developer/LowLevelTestsRunner/Private/TestRunner.cpp:208

Scope (from outer to inner):

file
namespace    UE::LowLevelTests
function     void FTestRunner::GlobalSetup

Source code excerpt:

	}

	FCommandLine::Set(*ExtraArgs);

	// Finish setting up the Game Thread, which requires the command line.
	FPlatformProcess::SetThreadAffinityMask(FPlatformAffinity::GetMainGameMask());
	FPlatformProcess::SetupGameThread();

	// Always set up GError to handle FatalError, failed assertions, and crashes and other fatal errors.

#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:940

Scope (from outer to inner):

file
namespace    UE::Zen
function     bool FServiceSettings::ReadFromConfig

Source code excerpt:

#endif // PLATFORM_WINDOWS

			GConfig->GetString(AutoLaunchConfigSection, TEXT("ExtraArgs"), AutoLaunchSettings.ExtraArgs, GEngineIni);

			ReadUInt16FromConfig(AutoLaunchConfigSection, TEXT("DesiredPort"), AutoLaunchSettings.DesiredPort, GEngineIni);
			GConfig->GetBool(AutoLaunchConfigSection, TEXT("ShowConsole"), AutoLaunchSettings.bShowConsole, GEngineIni);
			GConfig->GetBool(AutoLaunchConfigSection, TEXT("LimitProcessLifetime"), AutoLaunchSettings.bLimitProcessLifetime, GEngineIni);
			ApplyProcessLifetimeOverride(AutoLaunchSettings.bLimitProcessLifetime);
			EnsureEditorSettingsConfigLoaded();

#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:976

Scope (from outer to inner):

file
namespace    UE::Zen
function     bool FServiceSettings::ReadFromCompactBinary

Source code excerpt:

			{
				AutoLaunchSettings.DataPath = FString(AutoLaunchSettingsObject["DataPath"].AsString());
				AutoLaunchSettings.ExtraArgs = FString(AutoLaunchSettingsObject["ExtraArgs"].AsString());
				AutoLaunchSettings.DesiredPort = AutoLaunchSettingsObject["DesiredPort"].AsInt16();
				AutoLaunchSettings.bShowConsole = AutoLaunchSettingsObject["ShowConsole"].AsBool();
				AutoLaunchSettings.bIsDefaultDataPath = AutoLaunchSettingsObject["IsDefaultDataPath"].AsBool();
				AutoLaunchSettings.bLimitProcessLifetime = AutoLaunchSettingsObject["LimitProcessLifetime"].AsBool();
				ApplyProcessLifetimeOverride(AutoLaunchSettings.bLimitProcessLifetime);
				AutoLaunchSettings.bSendUnattendedBugReports = AutoLaunchSettingsObject["SendUnattendedBugReports"].AsBool();

#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1037

Scope (from outer to inner):

file
namespace    UE::Zen
function     void FServiceSettings::WriteToCompactBinary

Source code excerpt:

		Writer.BeginObject("AutoLaunchSettings");
		Writer << "DataPath" << AutoLaunchSettings.DataPath;
		Writer << "ExtraArgs" <<AutoLaunchSettings.ExtraArgs;
		Writer << "DesiredPort" << AutoLaunchSettings.DesiredPort;
		Writer << "ShowConsole" << AutoLaunchSettings.bShowConsole;
		Writer << "IsDefaultDataPath" << AutoLaunchSettings.bIsDefaultDataPath;
		Writer << "LimitProcessLifetime" << AutoLaunchSettings.bLimitProcessLifetime;
		Writer << "SendUnattendedBugReports" << AutoLaunchSettings.bSendUnattendedBugReports;
		Writer << "IsDefaultSharedRunContext" << AutoLaunchSettings.bIsDefaultSharedRunContext;

#Loc: <Workspace>/Engine/Source/Developer/Zen/Private/ZenServerInterface.cpp:1608

Scope (from outer to inner):

file
namespace    UE::Zen
function     static FString DetermineCmdLineWithoutTransientComponents

Source code excerpt:

		*PlatformDataPath);

	if (!InSettings.ExtraArgs.IsEmpty())
	{
		Parms.AppendChar(TEXT(' '));
		Parms.Append(InSettings.ExtraArgs);
	}

	FString LogCommandLineOverrideValue;
	if (FParse::Value(FCommandLine::Get(), TEXT("ZenLogPath="), LogCommandLineOverrideValue))
	{
		if (!LogCommandLineOverrideValue.IsEmpty())

#Loc: <Workspace>/Engine/Source/Developer/Zen/Public/Experimental/ZenServerInterface.h:39

Scope (from outer to inner):

file
namespace    UE::Zen

Source code excerpt:

{
	FString DataPath;
	FString ExtraArgs;
	uint16 DesiredPort = 8558;
	bool bShowConsole = false;
	bool bIsDefaultDataPath = false;
	bool bLimitProcessLifetime = false;
	bool bSendUnattendedBugReports = false;
	bool bIsDefaultSharedRunContext = true;

#Loc: <Workspace>/Engine/Source/Developer/Zen/Tests/ZenTest.cpp:30

Scope (from outer to inner):

file
namespace    UE

Source code excerpt:

			FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
			ZenTestAutoLaunchSettings.DataPath = DefaultDataPath;
			ZenTestAutoLaunchSettings.ExtraArgs = DefaultArgs;
			ZenTestAutoLaunchSettings.DesiredPort = DefaultTestPort;

			{
				FScopeZenService ScopeZenService(MoveTemp(ZenTestServiceSettings));
				FZenServiceInstance& ZenInstance = ScopeZenService.GetInstance();
				uint16 AutoLaunchedPort = ZenInstance.GetAutoLaunchedPort();

#Loc: <Workspace>/Engine/Source/Developer/Zen/Tests/ZenTest.cpp:55

Scope (from outer to inner):

file
namespace    UE

Source code excerpt:

			FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
			ZenTestAutoLaunchSettings.DataPath = DefaultDataPath;
			ZenTestAutoLaunchSettings.ExtraArgs = DefaultArgs;
			ZenTestAutoLaunchSettings.DesiredPort = DefaultTestPort;

			{
				FScopeZenService ScopeZenService(MoveTemp(ZenTestServiceSettings));
				FZenServiceInstance& ZenInstance = ScopeZenService.GetInstance();
				uint16 AutoLaunchedPort = ZenInstance.GetAutoLaunchedPort();

#Loc: <Workspace>/Engine/Source/Developer/Zen/Tests/ZenTest.cpp:80

Scope (from outer to inner):

file
namespace    UE

Source code excerpt:

			FServiceAutoLaunchSettings& ZenTestAutoLaunchSettings = ZenTestServiceSettings.SettingsVariant.Get<FServiceAutoLaunchSettings>();
			ZenTestAutoLaunchSettings.DataPath = DefaultDataPath;
			ZenTestAutoLaunchSettings.ExtraArgs = *WriteToString<128>(DefaultArgs, TEXT(" --gc-interval-seconds "), (Iteration+1)*1000);
			ZenTestAutoLaunchSettings.DesiredPort = DefaultTestPort;

			{
				FScopeZenService ScopeZenService(MoveTemp(ZenTestServiceSettings));
				FZenServiceInstance& ZenInstance = ScopeZenService.GetInstance();
				uint16 AutoLaunchedPort = ZenInstance.GetAutoLaunchedPort();

#Loc: <Workspace>/Engine/Source/Editor/WorldPartitionEditor/Private/WorldPartitionEditorModule.cpp:827

Scope (from outer to inner):

file
function     bool FWorldPartitionEditorModule::BuildHLODs

Source code excerpt:

	{
		FRunBuilderParams ParamsCopy(InParams);
		ParamsCopy.ExtraArgs = BuildHLODsDialog->GetDialogResult() == SWorldPartitionBuildHLODsDialog::DialogResult::BuildHLODs ? "-SetupHLODs -BuildHLODs -AllowCommandletRendering" : "-DeleteHLODs";
		ParamsCopy.OperationDescription = LOCTEXT("HLODBuildProgress", "Building HLODs...");

		return Build(ParamsCopy);
	}

	return false;

#Loc: <Workspace>/Engine/Source/Editor/WorldPartitionEditor/Private/WorldPartitionEditorModule.cpp:840

Scope (from outer to inner):

file
function     bool FWorldPartitionEditorModule::BuildMinimap

Source code excerpt:

{
	FRunBuilderParams ParamsCopy(InParams);
	ParamsCopy.ExtraArgs = "-AllowCommandletRendering";
	ParamsCopy.OperationDescription = LOCTEXT("MinimapBuildProgress", "Building minimap...");
	return Build(ParamsCopy);
}

bool FWorldPartitionEditorModule::Build(const FRunBuilderParams& InParams)
{

#Loc: <Workspace>/Engine/Source/Editor/WorldPartitionEditor/Private/WorldPartitionEditorModule.cpp:871

Scope (from outer to inner):

file
function     bool FWorldPartitionEditorModule::Build

Source code excerpt:

	CommandletArgsBuilder.Append(ParamsCopy.BuilderClass->GetName());
		
	if (!ParamsCopy.ExtraArgs.IsEmpty())
	{
		CommandletArgsBuilder.Append(" ");
		CommandletArgsBuilder.Append(ParamsCopy.ExtraArgs);
	}

	const FText OperationDescription = ParamsCopy.OperationDescription.IsEmptyOrWhitespace() ? LOCTEXT("BuildProgress", "Building...") : ParamsCopy.OperationDescription;

	int32 Result;
	bool bCancelled;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Tests/KismetArrayTests.cpp:14

Scope (from outer to inner):

file
namespace    UE::Kismet::Test
namespace    Private
function     void VerifySort

Source code excerpt:

			const TArray<ElementType>& InExpected,
			InSortFunc SortFunc,
			InArgs... ExtraArgs)
		{
			const auto RunTest = [&](const TCHAR* SortType, bool bStableSort, EArraySortOrder SortOrder)
			{
				TArray<ElementType> ArrayCopy = InArray;
				TArray<ElementType> ExpectedCopy = InExpected;
				if (SortOrder == EArraySortOrder::Descending)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Tests/KismetArrayTests.cpp:25

Scope (from outer to inner):

file
namespace    UE::Kismet::Test
namespace    Private
function     void VerifySort
lambda-function

Source code excerpt:

				}

				Invoke(SortFunc, ArrayCopy, bStableSort, SortOrder, ExtraArgs...);

				const auto ToStringHelper = [](const ElementType& Element) { return LexToString(Element); };

				const FString ErrorMessage = FString::Printf(
					TEXT("Sorted array doesn't match expected array for %s sort. Sorted: %s, Expected: %s."),
					SortType,

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/WorldPartition/IWorldPartitionEditorModule.h:24

Scope (from outer to inner):

file
class        class IWorldPartitionEditorModule : public IModuleInterface

Source code excerpt:

		TSubclassOf<UWorldPartitionBuilder> BuilderClass = nullptr;
		UWorld* World = nullptr;
		FString ExtraArgs;
		FText OperationDescription;
	};

	virtual bool RunBuilder(TSubclassOf<UWorldPartitionBuilder> BuilderClass, UWorld* InWorld);
	virtual bool RunBuilder(const FRunBuilderParams& Params) = 0;

#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Private/CommonSessionSubsystem.cpp:267

Scope (from outer to inner):

file
function     FString UCommonSession_HostSessionRequest::ConstructTravelURL

Source code excerpt:

	}

	for (const auto& KVP : ExtraArgs)
	{
		if (!KVP.Key.IsEmpty())
		{
			if (KVP.Value.IsEmpty())
			{
				CombinedExtraArgs += FString::Printf(TEXT("?%s"), *KVP.Key);

#Loc: <Workspace>/Projects/Lyra/Plugins/CommonUser/Source/CommonUser/Public/CommonSessionSubsystem.h:73

Scope (from outer to inner):

file
class        class UCommonSession_HostSessionRequest : public UObject

Source code excerpt:

	/** Extra arguments passed as URL options to the game */
	UPROPERTY(BlueprintReadWrite, Category=Session)
	TMap<FString, FString> ExtraArgs;

	/** Maximum players allowed per gameplay session */
	UPROPERTY(BlueprintReadWrite, Category=Session)
	int32 MaxPlayerCount = 16;

public:

#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/GameModes/LyraUserFacingExperienceDefinition.cpp:33

Scope (from outer to inner):

file
function     UCommonSession_HostSessionRequest* ULyraUserFacingExperienceDefinition::CreateHostingRequest

Source code excerpt:

	Result->MapID = MapID;
	Result->ModeNameForAdvertisement = UserFacingExperienceName;
	Result->ExtraArgs = ExtraArgs;
	Result->ExtraArgs.Add(TEXT("Experience"), ExperienceName);
	Result->MaxPlayerCount = MaxPlayerCount;

	if (ULyraReplaySubsystem::DoesPlatformSupportReplays())
	{
		if (bRecordReplay)
		{
			Result->ExtraArgs.Add(TEXT("DemoRec"), FString());
		}
	}

	return Result;
}

#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/GameModes/LyraUserFacingExperienceDefinition.h:30

Scope (from outer to inner):

file
class        class ULyraUserFacingExperienceDefinition : public UPrimaryDataAsset

Source code excerpt:

	/** Extra arguments passed as URL options to the game */
	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category=Experience)
	TMap<FString, FString> ExtraArgs;

	/** Primary title in the UI */
	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category=Experience)
	FText TileTitle;

	/** Secondary title */