Mainframe.ShowRestoreAssetsPromptOnStartup
Mainframe.ShowRestoreAssetsPromptOnStartup
#Overview
name: Mainframe.ShowRestoreAssetsPromptOnStartup
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Mainframe.ShowRestoreAssetsPromptOnStartup is to control whether the Unreal Engine editor should prompt users to restore previously open assets when starting up.
This setting variable is primarily used in the MainFrame module of Unreal Engine’s editor system. It’s specifically utilized in the FMainFrameHandler class, which is responsible for managing the main editor window.
The value of this variable is set as a static boolean with a default value of true. It’s exposed as a console variable using FAutoConsoleVariableRef, allowing it to be modified through the console or configuration files.
This variable interacts closely with another variable called ShowRestoreAssetsPromptInPIE. Together, they determine whether to restore asset windows when running with Play-In-Editor (PIE) at startup.
Developers must be aware that this variable affects the user experience when starting the Unreal Engine editor. When set to true, it will prompt users to restore previously open assets, which can be helpful for continuing work but might also slow down the startup process.
Best practices for using this variable include:
- Consider setting it to false in scenarios where quick startup is crucial.
- Be mindful of its interaction with ShowRestoreAssetsPromptInPIE, as both need to be true for asset restoration in PIE.
- Use it in conjunction with the UAssetEditorSubsystem to manage asset editor windows effectively.
Regarding the associated variable ShowRestoreAssetsPromptOnStartup:
The purpose of ShowRestoreAssetsPromptOnStartup is to serve as the actual boolean flag that controls the asset restoration prompt behavior.
This variable is used directly in the MainFrame module, specifically in the FMainFrameHandler::ShowMainFrameWindow function.
Its value is set as a static boolean, initialized to true, and it’s linked to the console variable Mainframe.ShowRestoreAssetsPromptOnStartup.
It interacts with ShowRestoreAssetsPromptInPIE to determine whether to restore asset windows in PIE mode.
Developers should be aware that this variable directly controls the behavior of asset restoration at startup, both in regular editor mode and potentially in PIE mode.
Best practices for using this variable include:
- Modifying it through the console or configuration files rather than changing the source code.
- Considering the performance implications of enabling asset restoration, especially on projects with many assets.
- Using it in combination with the UAssetEditorSubsystem’s RequestRestorePreviouslyOpenAssets function for proper asset management.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/MainFrame/Private/Frame/MainFrameHandler.cpp:10
Scope: file
Source code excerpt:
static bool ShowRestoreAssetsPromptOnStartup = true;
FAutoConsoleVariableRef CVarShowRestoreAssetsPromptOnStartup(TEXT("Mainframe.ShowRestoreAssetsPromptOnStartup"), ShowRestoreAssetsPromptOnStartup, TEXT(""), ECVF_ReadOnly);
static bool ShowRestoreAssetsPromptInPIE = false;
FAutoConsoleVariableRef CVarShowRestoreAssetsPromptInPIE(TEXT("Mainframe.ShowRestoreAssetsPromptInPIE"), ShowRestoreAssetsPromptInPIE,
TEXT("Restore asset windows when running with PIE at startup (default: false). This doesn't work with immersive mode or if Mainframe.ShowRestoreAssetsPromptOnStartup is set to false."));
void FMainFrameHandler::ShowMainFrameWindow(TSharedRef<SWindow> Window, const bool bStartImmersive, const bool bStartPIE) const
#Associated Variable and Callsites
This variable is associated with another variable named ShowRestoreAssetsPromptOnStartup
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/MainFrame/Private/Frame/MainFrameHandler.cpp:9
Scope: file
Source code excerpt:
#include "Subsystems/AssetEditorSubsystem.h"
static bool ShowRestoreAssetsPromptOnStartup = true;
FAutoConsoleVariableRef CVarShowRestoreAssetsPromptOnStartup(TEXT("Mainframe.ShowRestoreAssetsPromptOnStartup"), ShowRestoreAssetsPromptOnStartup, TEXT(""), ECVF_ReadOnly);
static bool ShowRestoreAssetsPromptInPIE = false;
FAutoConsoleVariableRef CVarShowRestoreAssetsPromptInPIE(TEXT("Mainframe.ShowRestoreAssetsPromptInPIE"), ShowRestoreAssetsPromptInPIE,
TEXT("Restore asset windows when running with PIE at startup (default: false). This doesn't work with immersive mode or if Mainframe.ShowRestoreAssetsPromptOnStartup is set to false."));
void FMainFrameHandler::ShowMainFrameWindow(TSharedRef<SWindow> Window, const bool bStartImmersive, const bool bStartPIE) const
#Loc: <Workspace>/Engine/Source/Editor/MainFrame/Private/Frame/MainFrameHandler.cpp:49
Scope (from outer to inner):
file
function void FMainFrameHandler::ShowMainFrameWindow
Source code excerpt:
GEngine->TickDeferredCommands();
if (ShowRestoreAssetsPromptInPIE && ShowRestoreAssetsPromptOnStartup)
{
// Restore any assets we had open. Can be requested to function in PIE
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->RequestRestorePreviouslyOpenAssets();
}
}
}
#Loc: <Workspace>/Engine/Source/Editor/MainFrame/Private/Frame/MainFrameHandler.cpp:81
Scope (from outer to inner):
file
function void FMainFrameHandler::ShowMainFrameWindow
Source code excerpt:
LevelEditor.FocusViewport();
if(ShowRestoreAssetsPromptOnStartup)
{
// Restore any assets we had open. Note we don't do this on immersive PIE as its annoying to the user.
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->RequestRestorePreviouslyOpenAssets();
}
}
}