bAutoSaveMaps

bAutoSaveMaps

#Overview

name: bAutoSaveMaps

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

#Summary

#Usage in the C++ source code

The purpose of bAutoSaveMaps is to control whether maps should be automatically saved during an autosave operation in Unreal Engine 5. This setting is part of the editor’s loading and saving system.

This setting variable is primarily used by the Unreal Engine’s Editor subsystem, specifically within the UnrealEd module. It is utilized in the PackageAutoSaver component, which handles the autosave functionality for the Unreal Editor.

The value of this variable is set in the EditorLoadingSavingSettings class, which is a UObject that stores various editor-related settings. It is defined as a UPROPERTY with the config specifier, meaning its value can be saved and loaded from configuration files.

bAutoSaveMaps interacts closely with another variable, bAutoSaveContent, which controls autosaving of content packages. These two variables often work in tandem to determine what types of assets should be automatically saved.

Developers should be aware that this variable directly impacts the autosave behavior of the Unreal Editor. When set to true, it will cause maps to be included in autosave operations, which can affect performance and disk usage, especially in projects with large or numerous maps.

Best practices when using this variable include:

  1. Consider the size and number of maps in your project when enabling this setting, as frequent autosaves of large maps can impact editor performance.
  2. Ensure that there’s sufficient disk space available for autosaved maps.
  3. Balance this setting with bAutoSaveContent based on your project’s needs and your team’s workflow.
  4. Be aware that enabling this might increase the time taken for autosave operations to complete.
  5. Use this in conjunction with other autosave settings like autosave interval to create an optimal autosave strategy for your project.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:175, 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:172

Scope (from outer to inner):

file
class        class UEditorLoadingSavingSettings : public UObject

Source code excerpt:

	/** Whether to automatically save maps during an autosave */
	UPROPERTY(EditAnywhere, config, Category=AutoSave, meta=(DisplayName="Save Maps"))
	uint32 bAutoSaveMaps:1;

	/** Whether to automatically save content packages during an autosave */
	UPROPERTY(EditAnywhere, config, Category=AutoSave, meta=(DisplayName="Save Content"))
	uint32 bAutoSaveContent:1;

	/** What method should be used when performing an autosave? */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PackageAutoSaver.cpp:256

Scope (from outer to inner):

file
function     void FPackageAutoSaver::AttemptAutoSave

Source code excerpt:

				SlowTask.EnterProgressFrame(50);

				if (LoadingSavingSettings->bAutoSaveMaps)
				{
					MapsSaveResults = FEditorFileUtils::AutosaveMapEx(AutoSaveDir, NewAutoSaveIndex, false, DirtyMapsForAutoSave);
					if (MapsSaveResults == EAutosaveContentPackagesResult::Success)
					{
						DirtyMapsForAutoSave.Empty();
					}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PackageAutoSaver.cpp:297

Scope (from outer to inner):

file
function     void FPackageAutoSaver::AttemptAutoSave

Source code excerpt:

					};
				
					if (LoadingSavingSettings->bAutoSaveMaps)
					{
						BackupExistingPackages(DirtyMapsForAutoSave);
					}
					if (LoadingSavingSettings->bAutoSaveContent)
					{
						BackupExistingPackages(DirtyContentForAutoSave);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PackageAutoSaver.cpp:329

Scope (from outer to inner):

file
function     void FPackageAutoSaver::AttemptAutoSave

Source code excerpt:

					};

					if (LoadingSavingSettings->bAutoSaveMaps)
					{
						AppendPackagesToSave(DirtyMapsForAutoSave);
					}
					if (LoadingSavingSettings->bAutoSaveContent)
					{
						AppendPackagesToSave(DirtyContentForAutoSave);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PackageAutoSaver.cpp:632

Scope (from outer to inner):

file
function     bool FPackageAutoSaver::DoPackagesNeedAutoSave

Source code excerpt:

	const bool bHasDirtyMapsForAutoSave = DirtyMapsForAutoSave.Num() != 0;
	const bool bHasDirtyContentForAutoSave = DirtyContentForAutoSave.Num() != 0;
	const bool bWorldsMightBeDirty = LoadingSavingSettings->bAutoSaveMaps && bHasDirtyMapsForAutoSave;
	const bool bContentPackagesMightBeDirty = LoadingSavingSettings->bAutoSaveContent && bHasDirtyContentForAutoSave;
	const bool bPackagesNeedAutoSave = bWorldsMightBeDirty || bContentPackagesMightBeDirty;

	return bPackagesNeedAutoSave;
}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PackageAutoSaver.cpp:646

Scope (from outer to inner):

file
function     FText FPackageAutoSaver::GetAutoSaveNotificationText

Source code excerpt:

		const UEditorLoadingSavingSettings* LoadingSavingSettings = GetDefault<UEditorLoadingSavingSettings>();
		int32 NumPackagesToAutoSave = 0;
		if (DirtyMapsForAutoSave.Num() != 0 && LoadingSavingSettings->bAutoSaveMaps)
		{
			NumPackagesToAutoSave += DirtyMapsForAutoSave.Num();
		}
		if (DirtyContentForAutoSave.Num() != 0 && LoadingSavingSettings->bAutoSaveContent)
		{
			NumPackagesToAutoSave += DirtyContentForAutoSave.Num();