LoadLevelAtStartup

LoadLevelAtStartup

#Overview

name: LoadLevelAtStartup

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

#Summary

#Usage in the C++ source code

The purpose of LoadLevelAtStartup is to control whether and which level should be loaded when the Unreal Editor starts up. This setting is part of the editor’s startup configuration and affects the initial state of the editor when it’s launched.

This setting variable is primarily used by the Unreal Editor subsystem, specifically within the UnrealEd module. It’s referenced in the EditorLoadingSavingSettings class, which is responsible for managing various editor-related loading and saving preferences.

The value of this variable is set in the project’s configuration files, likely in the EditorPerProjectIni file. It’s defined as a UPROPERTY with the ‘config’ specifier, which means it can be modified through project settings in the editor interface.

LoadLevelAtStartup interacts with other variables and systems:

  1. It’s used in conjunction with the “LastLevel” setting stored in the EditorStartup section of the configuration file.
  2. It’s part of a broader startup process that includes other actions like forcing project compilation (bForceCompilationAtStartup).

Developers should be aware of the following when using this variable:

  1. It’s an enum (ELoadLevelAtStartup::Type) with at least three options: None, LastOpened, and possibly a default project map option.
  2. The setting affects the editor’s startup performance and initial state, which can impact workflow and productivity.
  3. It’s part of the editor settings, not runtime game settings.

Best practices when using this variable include:

  1. Consider the team’s workflow when choosing a setting. For large teams, loading no map by default might be faster, while individual developers might prefer loading the last opened map.
  2. Be mindful of the impact on startup time, especially for large projects or when working with slower hardware.
  3. Ensure that the “LastLevel” setting is properly maintained if using the LastOpened option.
  4. Document the chosen setting in the project’s development guidelines to ensure consistency across the team.
  5. Regularly review this setting as the project grows to ensure it still meets the team’s needs and doesn’t unnecessarily impact startup times.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:166, section: [/Script/UnrealEd.EditorLoadingSavingSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/EditorLoadingSavingSettings.h:101

Scope (from outer to inner):

file
class        class UEditorLoadingSavingSettings : public UObject

Source code excerpt:

	/** Whether to load a default example map at startup  */
	UPROPERTY(EditAnywhere, config, Category=Startup)
	TEnumAsByte<ELoadLevelAtStartup::Type> LoadLevelAtStartup;

	/** Force project compilation at startup */
	UPROPERTY(EditAnywhere, config, Category=Startup)
	uint32 bForceCompilationAtStartup:1;

	/** Whether to restore previously open assets at startup after a clean shutdown */

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

Scope (from outer to inner):

file
function     void FEditorFileUtils::LoadDefaultMapAtStartup

Source code excerpt:

	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()) 
	{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdMisc.cpp:368

Scope (from outer to inner):

file
function     void FUnrealEdMisc::OnInit

Source code excerpt:

			if (!bMapLoaded && GEditor)
			{
				if (GetDefault<UEditorLoadingSavingSettings>()->LoadLevelAtStartup != ELoadLevelAtStartup::None)
				{
					FEditorFileUtils::LoadDefaultMapAtStartup();
					BeginPerformanceSurvey();
				}
			}
		}