bAutoSaveEnable

bAutoSaveEnable

#Overview

name: bAutoSaveEnable

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 bAutoSaveEnable is to control whether the automatic saving feature is enabled in the Unreal Engine editor. This setting variable is primarily used for the editor’s auto-save functionality, which is part of the loading and saving system.

The Unreal Engine subsystem that relies on this setting variable is primarily the UnrealEd module, specifically the editor’s file handling and auto-save features. This can be seen from the file locations where the variable is referenced, such as UnrealEd/Private/FileHelpers.cpp and UnrealEd/Private/PackageAutoSaver.cpp.

The value of this variable is set in the EditorLoadingSavingSettings class, which is likely configured through the editor’s project settings or preferences.

This variable interacts with other auto-save related variables, such as bAutoSaveMaps, AutoSaveTimeMinutes, and AutoSaveWarningInSeconds. These variables work together to control various aspects of the auto-save functionality.

Developers must be aware that:

  1. This variable can be toggled to enable or disable auto-save functionality.
  2. It affects both map and content package auto-saving.
  3. It is temporarily disabled during “Save As…” operations to prevent conflicts.

Best practices when using this variable include:

  1. Ensure it is enabled in production environments to prevent data loss.
  2. Be aware of its interaction with other auto-save settings to fine-tune the auto-save behavior.
  3. Consider the impact on performance and user experience when enabling or disabling auto-save, especially for large projects.
  4. Use it in conjunction with other safety measures, such as version control systems, to ensure robust data protection.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
class        class UEditorLoadingSavingSettings : public UObject

Source code excerpt:

	/** Whether to automatically save after a time interval */
	UPROPERTY(EditAnywhere, config, Category=AutoSave, meta=(DisplayName="Enable AutoSave"))
	uint32 bAutoSaveEnable:1;

	/** 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 */

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

Scope (from outer to inner):

file
function     static bool SaveAsImplementation

Source code excerpt:


	// Disable autosaving while the "Save As..." dialog is up.
	const bool bOldAutoSaveState = LoadingSavingSettings->bAutoSaveEnable;
	LoadingSavingSettings->bAutoSaveEnable = false;

	bool bStatus = false;

	// Loop through until a valid filename is given or the user presses cancel
	bool bFilenameIsValid = false;

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

Scope (from outer to inner):

file
function     static bool SaveAsImplementation

Source code excerpt:


	// Restore autosaving to its previous state.
	LoadingSavingSettings->bAutoSaveEnable = bOldAutoSaveState;

	// Update SCC state
	ISourceControlModule::Get().QueueStatusUpdate(InWorld->GetOutermost());

	if (bStatus && OutSavedFilename)
	{

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

Scope (from outer to inner):

file
function     void FPackageAutoSaver::AttemptAutoSave

Source code excerpt:


	// Don't auto-save if disabled or if it is not yet time to auto-save.
	const bool bTimeToAutosave = (LoadingSavingSettings->bAutoSaveEnable && AutoSaveCount >= LoadingSavingSettings->AutoSaveTimeMinutes * 60.0f);
	bool bAutosaveHandled = false;

	if (bTimeToAutosave)
	{
		ClearStalePointers();

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

Scope (from outer to inner):

file
function     bool FPackageAutoSaver::CanAutoSave

Source code excerpt:


	const bool bDidInteractRecently = (FApp::GetCurrentTime() - LastInteractionTime) < InteractionDelay;
	const bool bAutosaveEnabled	= LoadingSavingSettings->bAutoSaveEnable && bPackagesNeedAutoSave;
	const bool bSlowTask = GIsSlowTask;
	const bool bPlayWorldValid = GUnrealEd->PlayWorld != nullptr;
	const bool bAnyMenusVisible	= FSlateApplication::Get().AnyMenusVisible();
	const bool bAutomationTesting = GIsAutomationTesting;
	const bool bIsInteracting = FSlateApplication::Get().HasAnyMouseCaptor() || FSlateApplication::Get().IsDragDropping() || GUnrealEd->IsUserInteracting() || (bDidInteractRecently && !bAutoSaveNotificationLaunched && !bDelayingDueToFailedSave);
	const bool bHasGameOrProjectLoaded = FApp::HasProjectName();

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

Scope (from outer to inner):

file
function     void FPackageAutoSaver::UpdateAutoSaveNotification

Source code excerpt:

	const int32 TimeInSecondsUntilAutosave = GetTimeTillAutoSave(bIgnoreCanAutoSave);

	const bool UserAllowsAutosave = LoadingSavingSettings->bAutoSaveEnable && !GIsDemoMode;
	const bool InGame = (GUnrealEd->PlayWorld != nullptr);

	if (UserAllowsAutosave && // The user has set to allow auto-save in preferences
		TimeInSecondsUntilAutosave < LoadingSavingSettings->AutoSaveWarningInSeconds && 
		!InGame // we want to hide auto-save if we are simulating/playing
		)