EditorStartupMap

EditorStartupMap

#Overview

name: EditorStartupMap

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 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of EditorStartupMap is to specify the map that will be loaded when the Unreal Engine editor starts up. It is a setting variable primarily used in the editor environment to determine the initial map displayed when launching the editor.

This setting variable is primarily utilized by the UnrealEd module, which is responsible for the editor functionality in Unreal Engine. It’s also referenced in other modules such as ConcertSyncClient, CookedEditor, and GameProjectGeneration, indicating its importance in various editor-related processes.

The value of EditorStartupMap is typically set in the project’s configuration files, specifically in the DefaultEngine.ini file under the [/Script/EngineSettings.GameMapsSettings] section. It can also be modified through the Project Settings in the editor.

EditorStartupMap interacts with other map-related variables such as GameDefaultMap and ServerDefaultMap. It’s often used in conjunction with these variables to determine the appropriate map to load in different contexts (editor startup, game default, server default).

Developers should be aware that:

  1. This variable affects the editor workflow, so changing it will impact the initial state when opening the project.
  2. It should point to a valid map within the project.
  3. Changes to this variable may require an editor restart to take effect.

Best practices when using this variable include:

  1. Ensuring the specified map exists and is appropriate for editor startup.
  2. Considering the impact on team workflow when changing this value in a shared project.
  3. Using it in conjunction with other default map settings for a consistent project setup.
  4. Regularly reviewing and updating this setting as the project evolves to ensure it reflects the most suitable startup map for development.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:11, section: [/Script/EngineSettings.GameMapsSettings]

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:69, section: [/Script/EngineSettings.GameMapsSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Private/ConcertSyncClientUtil.cpp:721

Scope (from outer to inner):

file
namespace    ConcertSyncClientUtil
function     void PurgePackages

Source code excerpt:

	{
		// The world being edited was purged and cannot be saved anymore, even with 'Save Current As', replace it by something sensible.
		FString StartupMapPackage = GetDefault<UGameMapsSettings>()->EditorStartupMap.GetLongPackageName();
		if (FPackageName::DoesPackageExist(StartupMapPackage))
		{
			UEditorLoadingAndSavingUtils::NewMapFromTemplate(StartupMapPackage, /*bSaveExistingMap*/false); // Expected to run GC internally.
		}
		else
		{

#Loc: <Workspace>/Engine/Source/Developer/CookedEditor/Private/CookedEditorPackageManager.cpp:175

Scope (from outer to inner):

file
function     void FIniCookedEditorPackageManager::GetProjectPackagesToCook

Source code excerpt:


	// make sure editor startup map is cooked
	FString EditorStartupMap;
	if (GConfig->GetString(TEXT("/Script/EngineSettings.GameMapsSettings"), TEXT("EditorStartupMap"), EditorStartupMap, GEngineIni))
	{
		PackagesToCook.Add(*EditorStartupMap);
	}

	// specific assets to cook
	PackagesToCook.Append(GetConfigArray(TEXT("ProjectSpecificAssetsToCook")));
}

#Loc: <Workspace>/Engine/Source/Editor/GameProjectGeneration/Private/GameProjectUtils.cpp:191

Scope (from outer to inner):

file
namespace    anonymous
function     void AddDefaultMapConfigValues

Source code excerpt:

			ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
				TEXT("/Script/EngineSettings.GameMapsSettings"),
				TEXT("EditorStartupMap"),
				DefaultMap,
				true /* ShouldReplaceExistingValue */);

			ConfigValues.Emplace(TEXT("DefaultEngine.ini"),
				TEXT("/Script/EngineSettings.GameMapsSettings"),
				TEXT("GameDefaultMap"),
				DefaultMap,
				true /* ShouldReplaceExistingValue */);
		}
	}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/FileHelpers.cpp:4950

Scope (from outer to inner):

file
function     void FEditorFileUtils::LoadDefaultMapAtStartup

Source code excerpt:

void FEditorFileUtils::LoadDefaultMapAtStartup()
{
	FString EditorStartupMap;
	// Last opened map.
	if (GetDefault<UEditorLoadingSavingSettings>()->LoadLevelAtStartup == ELoadLevelAtStartup::LastOpened)
	{
		GConfig->GetString(TEXT("EditorStartup"), TEXT("LastLevel"), EditorStartupMap, GEditorPerProjectIni);
	}
	// Default project map.
	if (EditorStartupMap.IsEmpty()) 
	{
		EditorStartupMap = GetDefault<UGameMapsSettings>()->EditorStartupMap.GetLongPackageName();
	}
	
	const bool bIncludeReadOnlyRoots = true;
	if ( FPackageName::IsValidLongPackageName(EditorStartupMap, bIncludeReadOnlyRoots) )
	{
		FString MapFilenameToLoad = FPackageName::LongPackageNameToFilename( EditorStartupMap );

		bIsLoadingDefaultStartupMap = true;
		FEditorFileUtils::LoadMap( MapFilenameToLoad + FPackageName::GetMapPackageExtension(), GUnrealEd && GUnrealEd->IsTemplateMap(EditorStartupMap), true );
		bIsLoadingDefaultStartupMap = false;
	}
}

void FEditorFileUtils::FindAllPackageFiles(TArray<FString>& OutPackages)
{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Tests/AutomationEditorCommon.cpp:1210

Scope (from outer to inner):

file
function     bool FProjectMapsPIETest::RunTest

Source code excerpt:

			UGameMapsSettings const* MapSettings = GetDefault<UGameMapsSettings>();

			if (MapSettings->EditorStartupMap.IsValid())
			{
				PIEMaps.Add(MapSettings->EditorStartupMap.GetLongPackageName());
			}

			if (MapSettings->GetGameDefaultMap().Len() && MapSettings->GetGameDefaultMap() != MapSettings->EditorStartupMap.GetLongPackageName())
			{
				PIEMaps.Add(MapSettings->GetGameDefaultMap());
			}
		}
	}

#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Classes/GameMapsSettings.h:149

Scope (from outer to inner):

file
class        class UGameMapsSettings : public UObject

Source code excerpt:

	/** If set, this map will be loaded when the Editor starts up. */
	UPROPERTY(config, EditAnywhere, Category=DefaultMaps, meta=(AllowedClasses="/Script/Engine.World"))
	FSoftObjectPath EditorStartupMap;

	/** Map templates that should show up in the new level dialog. This will completely override the default maps chosen by the default editor */
	UPROPERTY(config, EditAnywhere, Category=DefaultMaps, meta=(ConfigRestartRequired=true))
	TArray<FTemplateMapInfoOverride> EditorTemplateMapOverrides;
#endif

#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:244

Scope (from outer to inner):

file
function     void UGameMapsSettings::PostInitProperties

Source code excerpt:


#if WITH_EDITORONLY_DATA
	FixMapAssetRef(EditorStartupMap);
#endif
	FixMapAssetRef(GameDefaultMap);
	FixMapAssetRef(ServerDefaultMap);
	FixMapAssetRef(TransitionMap);
}

#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:256

Scope (from outer to inner):

file
function     void UGameMapsSettings::PostReloadConfig

Source code excerpt:

	{
#if WITH_EDITORONLY_DATA
		if (PropertyThatWasLoaded->GetFName() == GET_MEMBER_NAME_CHECKED(UGameMapsSettings, EditorStartupMap))
		{
			FixMapAssetRef(EditorStartupMap);
		}
		else
#endif
		if (PropertyThatWasLoaded->GetFName() == GET_MEMBER_NAME_CHECKED(UGameMapsSettings, GameDefaultMap))
		{
			FixMapAssetRef(GameDefaultMap);

#Loc: <Workspace>/Engine/Source/Runtime/EngineSettings/Private/EngineSettingsModule.cpp:278

Scope (from outer to inner):

file
function     void UGameMapsSettings::PostReloadConfig

Source code excerpt:

	{
#if WITH_EDITORONLY_DATA
		FixMapAssetRef(EditorStartupMap);
#endif
		FixMapAssetRef(GameDefaultMap);
		FixMapAssetRef(ServerDefaultMap);
		FixMapAssetRef(TransitionMap);
	}
}