bValidateOnSave
bValidateOnSave
#Overview
name: bValidateOnSave
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bValidateOnSave is to control whether assets should be validated automatically when they are saved in the Unreal Engine editor. This setting is part of the Data Validation system in Unreal Engine 5.
This setting variable is primarily used by the Data Validation module, which is part of the Editor subsystem in Unreal Engine 5. Specifically, it’s used within the EditorValidatorSubsystem, which is responsible for managing and executing validation checks on assets.
The value of this variable is set in the UDataValidationSettings class, which inherits from UDeveloperSettings. This means it can be configured through the Project Settings in the Unreal Engine editor.
The bValidateOnSave variable interacts with other parts of the engine, particularly:
- It’s checked against GEditor->IsAutosaving() to prevent validation during autosaves.
- It’s used in conjunction with a bProceduralSave flag to determine whether to validate during certain types of saves.
Developers should be aware of the following when using this variable:
- Setting it to true may impact performance, as validation will occur on every save operation.
- It doesn’t trigger during autosaves, which is a performance optimization.
- There’s a deprecated property with the same name in UEditorValidatorSubsystem, which should be avoided in favor of the UDataValidationSettings version.
Best practices for using this variable include:
- Consider the performance implications of enabling it, especially for large projects or on less powerful development machines.
- Use it in conjunction with other Data Validation settings to create a comprehensive validation strategy.
- Be aware that it may not catch issues introduced during runtime or through non-save operations.
- Regularly review and update validation rules to ensure they remain relevant and effective.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditor.ini:619, section: [/Script/DataValidation.DataValidationManager]
- INI Section:
/Script/DataValidation.DataValidationManager
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Editor/DataValidation/Source/DataValidation/Private/EditorValidatorSubsystem.cpp:669
Scope (from outer to inner):
file
function void UEditorValidatorSubsystem::ValidateOnSave
Source code excerpt:
{
// Only validate if enabled and not auto saving
if (!GetDefault<UDataValidationSettings>()->bValidateOnSave || GEditor->IsAutosaving())
{
return;
}
if (bProceduralSave)
{
#Loc: <Workspace>/Engine/Plugins/Editor/DataValidation/Source/DataValidation/Private/EditorValidatorSubsystem.cpp:710
Scope (from outer to inner):
file
function void UEditorValidatorSubsystem::ValidateSavedPackage
Source code excerpt:
{
// Only validate if enabled and not auto saving
if (!GetDefault<UDataValidationSettings>()->bValidateOnSave || GEditor->IsAutosaving())
{
return;
}
// For performance reasons, don't validate when making a procedural save by default. Assumption is we validated when saving previously.
if (bProceduralSave)
#Loc: <Workspace>/Engine/Plugins/Editor/DataValidation/Source/DataValidation/Public/DataValidationSettings.h:20
Scope (from outer to inner):
file
class class UDataValidationSettings : public UDeveloperSettings
Source code excerpt:
/** Whether or not to validate assets on save */
UPROPERTY(EditAnywhere, config, Category="Data Validation")
uint32 bValidateOnSave : 1 = true;
/** Whether or not to load & validate assets in changelists by default */
UPROPERTY(EditAnywhere, config, Category="Data Validation")
uint32 bLoadAssetsWhenValidatingChangelists : 1 = true;
};
#Loc: <Workspace>/Engine/Plugins/Editor/DataValidation/Source/DataValidation/Public/EditorValidatorSubsystem.h:397
Scope (from outer to inner):
file
class class UEditorValidatorSubsystem : public UEditorSubsystem
Source code excerpt:
*/
UPROPERTY(config, meta = (DeprecatedProperty, DeprecationMessage = "Use bValidateOnSave on UDataValidationSettings instead."))
bool bValidateOnSave;
/** List of saved package names to validate next frame */
TArray<FName> SavedPackagesToValidate;
UPROPERTY(Transient)
TMap<FTopLevelAssetPath, TObjectPtr<UEditorValidatorBase>> Validators;