wp.Editor.EnableSpatialHashValidation
wp.Editor.EnableSpatialHashValidation
#Overview
name: wp.Editor.EnableSpatialHashValidation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to enable World Partition editor spatial hash validation
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of wp.Editor.EnableSpatialHashValidation is to control whether the World Partition editor spatial hash validation is enabled or not. This setting is specifically for the World Partition system in Unreal Engine 5’s editor environment.
Based on the details in the Callsites section, this setting variable is primarily used in the World Partition module of Unreal Engine. It’s referenced in the WorldPartitionEditorSpatialHash.cpp file, which suggests it’s part of the World Partition editor functionality.
The value of this variable is set as a console variable (CVar) using TAutoConsoleVariable. It’s initialized with a default value of false, meaning the spatial hash validation is disabled by default.
The associated variable CVarEnableSpatialHashValidation directly interacts with wp.Editor.EnableSpatialHashValidation. They share the same value and purpose.
Developers must be aware that this variable is only available in editor builds (#if WITH_EDITOR preprocessor directive). It’s not meant for use in runtime builds of the game.
Best practices when using this variable include:
- Only enable it when debugging or validating the World Partition editor spatial hash.
- Be aware of potential performance implications when enabled, as validation checks may introduce additional processing overhead.
- Use it in conjunction with other World Partition debugging tools for comprehensive testing.
Regarding the associated variable CVarEnableSpatialHashValidation:
The purpose of CVarEnableSpatialHashValidation is the same as wp.Editor.EnableSpatialHashValidation - to control the enablement of World Partition editor spatial hash validation.
This variable is used directly in the UWorldPartitionEditorSpatialHash::Tick function to conditionally execute validation code. When enabled, it performs checks related to the editor bounds and hash levels.
The value of CVarEnableSpatialHashValidation can be accessed at runtime using the GetValueOnAnyThread() method, allowing for dynamic checking of the validation state.
Developers should be aware that changes to this variable will immediately affect the behavior of the World Partition editor spatial hash system. Enabling it may impact editor performance, so it should be used judiciously, primarily for debugging and validation purposes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/WorldPartitionEditorSpatialHash.cpp:10
Scope: file
Source code excerpt:
#if WITH_EDITOR
TAutoConsoleVariable<bool> CVarEnableSpatialHashValidation(TEXT("wp.Editor.EnableSpatialHashValidation"), false, TEXT("Whether to enable World Partition editor spatial hash validation"), ECVF_Default);
#endif
UWorldPartitionEditorSpatialHash::UWorldPartitionEditorSpatialHash(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
#if WITH_EDITORONLY_DATA
, CellSize(12800)
#Associated Variable and Callsites
This variable is associated with another variable named CVarEnableSpatialHashValidation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/WorldPartitionEditorSpatialHash.cpp:10
Scope: file
Source code excerpt:
#if WITH_EDITOR
TAutoConsoleVariable<bool> CVarEnableSpatialHashValidation(TEXT("wp.Editor.EnableSpatialHashValidation"), false, TEXT("Whether to enable World Partition editor spatial hash validation"), ECVF_Default);
#endif
UWorldPartitionEditorSpatialHash::UWorldPartitionEditorSpatialHash(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
#if WITH_EDITORONLY_DATA
, CellSize(12800)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/WorldPartitionEditorSpatialHash.cpp:95
Scope (from outer to inner):
file
function void UWorldPartitionEditorSpatialHash::Tick
Source code excerpt:
}
if (CVarEnableSpatialHashValidation.GetValueOnAnyThread())
{
if (EditorBounds.IsValid)
{
const int32 CurrentLevel = GetLevelForBox(EditorBounds);
check(CurrentLevel == HashLevels.Num() - 1);