LaunchOnTarget

LaunchOnTarget

#Overview

name: LaunchOnTarget

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of LaunchOnTarget is to specify the target name for launching a game or client in Unreal Engine 5. This setting is primarily used in the development and editor environment to determine which target should be launched when initiating a play session or building the project.

LaunchOnTarget is part of the DeveloperToolSettings module, specifically within the PlatformsMenuSettings class. This setting is utilized by the TurnkeySupport module, which is responsible for various editor and development-related functionalities.

The value of this variable is set in the SetLaunchOnBuildTarget function of the FTurnkeySupportCallbacks class. It is stored in the UPlatformsMenuSettings object and saved to the configuration file.

LaunchOnTarget interacts with the GetLaunchOnTargetInfo() function, which retrieves the current launch target information, ensuring it’s valid or falling back to a default build target if not.

Developers should be aware that:

  1. This variable affects which target is launched when using the editor’s play or build functionalities.
  2. Changes to this setting are persistent as they are saved to the configuration file.
  3. The target specified must be a valid Game or Client target.

Best practices when using this variable include:

  1. Ensure the specified target exists and is properly configured in the project.
  2. Use the SetLaunchOnBuildTarget function to modify this value, as it handles the necessary configuration saving.
  3. Verify the current launch target using the GetLaunchOnTargetInfo() function before performing launch-related operations.
  4. Consider the implications of changing this setting on team workflows, especially in multi-target projects.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:160, section: [/Script/DeveloperToolSettings.PlatformsMenuSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:86, section: [/Script/UnrealEd.ProjectPackagingSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Classes/Settings/PlatformsMenuSettings.h:22

Scope (from outer to inner):

file
class        class UPlatformsMenuSettings : public UObject

Source code excerpt:

	/** Name of the target to use for LaunchOn (only Game/Client targets) */
	UPROPERTY(config)
	FString LaunchOnTarget;

	/** Gets the current launch on target, checking that it's valid, and the default build target if it is not */
	const FTargetInfo* GetLaunchOnTargetInfo() const;
	
	/**
	 * Get and set the per-platform build config and targetplatform settings for the Turnkey/Launch on menu

#Loc: <Workspace>/Engine/Source/Developer/DeveloperToolSettings/Private/PlatformsMenuSettings.cpp:81

Scope (from outer to inner):

file
function     const FTargetInfo* UPlatformsMenuSettings::GetLaunchOnTargetInfo

Source code excerpt:

const FTargetInfo* UPlatformsMenuSettings::GetLaunchOnTargetInfo() const
{
	return FindBestTargetInfo(LaunchOnTarget, true, nullptr);
}

#undef LOCTEXT_NAMESPACE

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:751

Scope (from outer to inner):

file
class        class FTurnkeySupportCallbacks
function     static void SetLaunchOnBuildTarget

Source code excerpt:

	{
		UPlatformsMenuSettings* PlatformsSettings = GetMutableDefault<UPlatformsMenuSettings>();
		PlatformsSettings->LaunchOnTarget = TargetName;
		PlatformsSettings->SaveConfig();
	}

	static bool LaunchOnBuildTargetIsChecked(FString TargetName)
	{
		return GetDefault<UPlatformsMenuSettings>()->GetLaunchOnTargetInfo()->Name == TargetName;