save.FixupStandaloneFlags
save.FixupStandaloneFlags
#Overview
name: save.FixupStandaloneFlags
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If non-zero, when the UAsset of a package is missing RF_Standalone, the flag is added. If zero, the flags are not changed and the save fails.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of save.FixupStandaloneFlags is to control whether the RF_Standalone flag should be automatically added to UAssets that are missing this flag during the package saving process. This setting is primarily used in the package saving subsystem of Unreal Engine.
The Unreal Engine subsystem that relies on this setting variable is the CoreUObject module, specifically the package saving functionality. This can be seen from the file locations where the variable is referenced, all of which are within the CoreUObject directory.
The value of this variable is set through a console variable (CVar) system. It’s defined as a global integer (GFixupStandaloneFlags) and linked to the console variable “save.FixupStandaloneFlags” using FAutoConsoleVariableRef.
This variable interacts with the RF_Standalone flag, which is a part of the object flags system in Unreal Engine. It also indirectly interacts with the TopLevelFlags used in package saving.
Developers must be aware that:
- When this variable is set to a non-zero value, the engine will automatically add the RF_Standalone flag to UAssets that are missing it during the save process.
- When set to zero, the engine will not modify the flags, which may result in save failures for assets missing the RF_Standalone flag.
Best practices when using this variable include:
- Use it cautiously, as automatically modifying object flags can have unintended consequences.
- Consider enabling it (setting to non-zero) when encountering save failures related to missing RF_Standalone flags, but investigate why the flag is missing in the first place.
- In production environments, it’s generally better to ensure assets have the correct flags set rather than relying on this automatic fix.
- When debugging save issues, developers can use the command line argument “-dpcvars=save.FixupStandaloneFlags=1” to enable this feature temporarily.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SavePackage2.cpp:60
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
int32 GFixupStandaloneFlags = 0;
static FAutoConsoleVariableRef CVar_FixupStandaloneFlags(
TEXT("save.FixupStandaloneFlags"),
GFixupStandaloneFlags,
TEXT("If non-zero, when the UAsset of a package is missing RF_Standalone, the flag is added. If zero, the flags are not changed and the save fails.")
);
ESavePackageResult WriteAdditionalFiles(FSaveContext& SaveContext, FScopedSlowTask& SlowTask, int64& VirtualExportsFileOffset);
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SavePackage/SaveContext.h:477
Scope (from outer to inner):
file
class class FSaveContext
function FSaveContext
Source code excerpt:
bIsProcessingPrestreamPackages = ProcessPrestreamingRequests->GetInt() > 0;
}
static const IConsoleVariable* FixupStandaloneFlags = IConsoleManager::Get().FindConsoleVariable(TEXT("save.FixupStandaloneFlags"));
if (FixupStandaloneFlags)
{
bIsFixupStandaloneFlags = FixupStandaloneFlags->GetInt() != 0;
}
ObjectSaveContext.Set(InPackage, GetTargetPlatform(), TargetPackagePath, SaveArgs.SaveFlags);
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SavePackage2.cpp:151
Scope (from outer to inner):
file
namespace anonymous
function ESavePackageResult ValidatePackage
Source code excerpt:
if (!Asset->GetExternalPackage() && EnumHasAnyFlags(TopLevelFlags, RF_Standalone))
{
ErrorText = FText::Format(NSLOCTEXT("SavePackage2", "AssetSaveMissingStandaloneFlag", "The Asset {Name} being saved does not have any of the provided object flags (0x{Flags}); saving the package would cause data loss. Run with -dpcvars=save.FixupStandaloneFlags=1 to add the RF_Standalone flag."),
Arguments);
}
else
{
ErrorText = FText::Format(NSLOCTEXT("SavePackage2", "AssetSaveMissingTopLevelFlags", "The Asset {Name} being saved does not have any of the provided object flags (0x{Flags}); saving the package would cause data loss."),
Arguments);