Mainframe.ShowRestoreAssetsPromptInPIE
Mainframe.ShowRestoreAssetsPromptInPIE
#Overview
name: Mainframe.ShowRestoreAssetsPromptInPIE
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
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.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Mainframe.ShowRestoreAssetsPromptInPIE is to control whether asset windows should be restored when running the game in Play-In-Editor (PIE) mode at startup. This setting is part of the Unreal Engine’s editor functionality, specifically related to asset management and the Play-In-Editor feature.
This setting variable is primarily used in the MainFrame module of Unreal Engine, which is responsible for managing the main editor window and its associated functionalities. Based on the callsites, it’s clear that this variable interacts with the LevelEditor module and the AssetEditorSubsystem.
The value of this variable is set as a static boolean variable and is exposed as a console variable through FAutoConsoleVariableRef. It is initialized to false by default, meaning that asset windows are not restored by default when starting PIE.
This variable interacts with another variable called ShowRestoreAssetsPromptOnStartup. Both of these variables need to be true for the asset restoration functionality to work in PIE mode.
Developers should be aware of the following when using this variable:
- It only works when not in immersive mode.
- It depends on the Mainframe.ShowRestoreAssetsPromptOnStartup setting also being true.
- Enabling this feature may impact the startup time of PIE sessions, as it will attempt to restore previously open asset windows.
Best practices when using this variable include:
- Only enable it when necessary for development workflows that require quick access to previously open assets in PIE mode.
- Be mindful of potential performance implications, especially on less powerful development machines.
- Use in conjunction with Mainframe.ShowRestoreAssetsPromptOnStartup for consistent behavior.
Regarding the associated variable ShowRestoreAssetsPromptInPIE:
The purpose of ShowRestoreAssetsPromptInPIE is to serve as the internal boolean representation of the Mainframe.ShowRestoreAssetsPromptInPIE console variable. It directly controls the behavior of asset restoration in PIE mode.
This variable is used within the MainFrameHandler class, specifically in the ShowMainFrameWindow function. It determines whether the AssetEditorSubsystem should be instructed to restore previously open assets when entering PIE mode.
The value of this variable is set through the console variable system, allowing it to be changed at runtime or through configuration files.
As mentioned earlier, it interacts closely with the ShowRestoreAssetsPromptOnStartup variable. Both need to be true for the asset restoration feature to be active in PIE mode.
Developers should be aware that this variable directly affects the behavior of the editor when entering PIE mode. Changing its value can impact the editor’s startup performance and the initial state of asset windows in PIE sessions.
Best practices for using this variable include:
- Use the console variable Mainframe.ShowRestoreAssetsPromptInPIE to modify its value, rather than attempting to change the static variable directly.
- Consider the impact on editor performance and user experience when enabling this feature, especially in projects with many complex assets.
- Coordinate its use with other editor settings to ensure a consistent and efficient development environment.
#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:13
Scope: file
Source code excerpt:
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
{
// Make sure viewport windows are maximized/immersed if they need to be
FLevelEditorModule& LevelEditor = FModuleManager::GetModuleChecked< FLevelEditorModule >( TEXT( "LevelEditor" ) );
#Associated Variable and Callsites
This variable is associated with another variable named ShowRestoreAssetsPromptInPIE
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Editor/MainFrame/Private/Frame/MainFrameHandler.cpp:12
Scope: file
Source code excerpt:
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
{
// Make sure viewport windows are maximized/immersed if they need to be
FLevelEditorModule& LevelEditor = FModuleManager::GetModuleChecked< FLevelEditorModule >( TEXT( "LevelEditor" ) );
#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();
}
}
}