AutoSaveTimeMinutes

AutoSaveTimeMinutes

#Overview

name: AutoSaveTimeMinutes

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 AutoSaveTimeMinutes is to control the frequency of automatic saves in the Unreal Engine editor. It specifies the time interval in minutes between automatic saves of open projects and assets.

This setting variable is primarily used by the Unreal Engine’s editor subsystem, specifically within the UnrealEd module. It’s a part of the editor’s loading and saving settings, which handle file management and data persistence.

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

AutoSaveTimeMinutes interacts with other variables such as:

  1. AutoSaveInteractionDelayInSeconds: Defines a delay after user interactions before auto-save can trigger.
  2. AutoSaveWarningInSeconds: Sets the duration of the warning before an auto-save occurs.
  3. bAutoSaveEnable: A boolean that determines whether auto-save is enabled or not.

Developers should be aware that:

  1. The variable is used to calculate the actual auto-save interval in seconds (AutoSaveTimeMinutes * 60).
  2. It’s used in conjunction with other variables to determine the precise timing of auto-saves.
  3. The value is clamped to a minimum of 1 minute.

Best practices when using this variable include:

  1. Setting a balanced value that ensures work is saved frequently enough to prevent data loss, but not so frequently that it interrupts workflow.
  2. Considering the size and complexity of the project when setting this value, as larger projects may require more time between saves.
  3. Using it in conjunction with other auto-save settings for a comprehensive save strategy.
  4. Regularly reviewing and adjusting this setting based on team feedback and project needs.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
class        class UEditorLoadingSavingSettings : public UObject

Source code excerpt:

	/** The time interval after which to auto save */
	UPROPERTY(EditAnywhere, config, Category=AutoSave, meta=(DisplayName="Frequency in Minutes", ClampMin = "1"))
	int32 AutoSaveTimeMinutes;

	/** The minimum number of seconds to wait after the last user interactions (with the editor) before auto-save can trigger */
	UPROPERTY(EditAnywhere, Config, Category = AutoSave, meta = (DisplayName = "Interaction Delay in Seconds", ClampMin = "15"))
	int32 AutoSaveInteractionDelayInSeconds;

	/** The number of seconds warning before an autosave*/

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

Scope (from outer to inner):

file
function     void FPackageAutoSaver::UpdateAutoSaveCount

Source code excerpt:

	const UEditorLoadingSavingSettings* LoadingSavingSettings = GetDefault<UEditorLoadingSavingSettings>();

	const float AutoSaveWarningTime = FMath::Max(0.0f, static_cast<float>(LoadingSavingSettings->AutoSaveTimeMinutes * 60 - LoadingSavingSettings->AutoSaveWarningInSeconds));

	// Make sure we don't skip the auto-save warning when debugging the editor. 
	if (AutoSaveCount < AutoSaveWarningTime && (AutoSaveCount + DeltaSeconds) > AutoSaveWarningTime)
	{
		AutoSaveCount = AutoSaveWarningTime;
	}

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

Scope (from outer to inner):

file
function     void FPackageAutoSaver::ForceAutoSaveTimer

Source code excerpt:

void FPackageAutoSaver::ForceAutoSaveTimer()
{
	AutoSaveCount = GetDefault<UEditorLoadingSavingSettings>()->AutoSaveTimeMinutes * 60.0f;
}

void FPackageAutoSaver::ForceMinimumTimeTillAutoSave(const float TimeTillAutoSave)
{
	const float MinumumTime = (GetDefault<UEditorLoadingSavingSettings>()->AutoSaveTimeMinutes * 60.0f) - TimeTillAutoSave;
	AutoSaveCount = (MinumumTime < AutoSaveCount) ? MinumumTime : AutoSaveCount;
}

void FPackageAutoSaver::AttemptAutoSave()
{
	const UEditorLoadingSavingSettings* LoadingSavingSettings = GetDefault<UEditorLoadingSavingSettings>();

#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:393

Scope (from outer to inner):

file
function     void FPackageAutoSaver::AttemptAutoSave

Source code excerpt:

			// Extend the time by 3 seconds if we failed to save because the user was interacting.  
			// We do this to avoid cases where they are rapidly clicking and are interrupted by autosaves
			AutoSaveCount = (LoadingSavingSettings->AutoSaveTimeMinutes*60.0f) - 3.0f;

			TSharedPtr<SNotificationItem> NotificationItem = AutoSaveNotificationPtr.Pin();

			// ensure the notification exists
			if (NotificationItem.IsValid())
			{

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

Scope (from outer to inner):

file
function     int32 FPackageAutoSaver::GetTimeTillAutoSave

Source code excerpt:

	if (bIgnoreCanAutoSave || CanAutoSave())
	{
		Result = FMath::CeilToInt(GetDefault<UEditorLoadingSavingSettings>()->AutoSaveTimeMinutes * 60.0f - AutoSaveCount);
	}

	return Result;
}

void FPackageAutoSaver::UpdateAutoSaveNotification()