landscape.ApplyPhysicalMaterialChangesImmediately
landscape.ApplyPhysicalMaterialChangesImmediately
#Overview
name: landscape.ApplyPhysicalMaterialChangesImmediately
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Applies physical material task changes immediately rather than during the next cook/PIE.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of landscape.ApplyPhysicalMaterialChangesImmediately is to control when physical material changes are applied to the landscape in Unreal Engine 5. It determines whether these changes should be applied immediately or deferred until the next cook or Play-in-Editor (PIE) session.
This setting variable is primarily used by the Landscape module within Unreal Engine’s rendering system. It affects how physical material changes are handled for landscape components.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1, meaning that changes are applied immediately by default.
The associated variable CVarLandscapeApplyPhysicalMaterialChangesImmediately interacts directly with this setting. It’s an instance of TAutoConsoleVariable
Developers should be aware that:
- This variable affects performance and behavior in the editor.
- Setting it to 0 will defer physical material changes, potentially improving editor performance but delaying visual updates.
- It’s primarily relevant in editor workflows and doesn’t affect runtime behavior in packaged games.
Best practices when using this variable include:
- Keep it enabled (set to 1) during active landscape editing for immediate visual feedback.
- Consider disabling it (set to 0) when working on large landscapes or if experiencing performance issues in the editor.
- Remember to re-enable it before final builds or when precise physical material representation is crucial for testing.
Regarding the associated variable CVarLandscapeApplyPhysicalMaterialChangesImmediately:
- It’s a console variable wrapper that allows easy access and modification of the landscape.ApplyPhysicalMaterialChangesImmediately setting from C++ code.
- It’s used in the ULandscapeComponent::UpdatePhysicalMaterialTasks() function to determine whether to finalize physical material changes immediately.
- Developers can use this variable to programmatically check or change the setting’s value, which can be useful for creating editor tools or custom landscape workflows.
When working with CVarLandscapeApplyPhysicalMaterialChangesImmediately, developers should:
- Use GetValueOnGameThread() to safely retrieve the current value.
- Be aware that changes to this variable will immediately affect landscape editing behavior.
- Consider exposing this option in custom editor tools if fine-grained control over landscape physical material updates is needed.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEdit.cpp:103
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLandscapeApplyPhysicalMaterialChangesImmediately(
TEXT("landscape.ApplyPhysicalMaterialChangesImmediately"),
1,
TEXT("Applies physical material task changes immediately rather than during the next cook/PIE."));
#if WITH_EDITOR
// Used to temporarily disable material instance updates (typically used for cases where multiple updates are called on sample component)
#Associated Variable and Callsites
This variable is associated with another variable named CVarLandscapeApplyPhysicalMaterialChangesImmediately
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEdit.cpp:102
Scope: file
Source code excerpt:
#define LOCTEXT_NAMESPACE "Landscape"
static TAutoConsoleVariable<int32> CVarLandscapeApplyPhysicalMaterialChangesImmediately(
TEXT("landscape.ApplyPhysicalMaterialChangesImmediately"),
1,
TEXT("Applies physical material task changes immediately rather than during the next cook/PIE."));
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeEdit.cpp:2116
Scope (from outer to inner):
file
function void ULandscapeComponent::UpdatePhysicalMaterialTasks
Source code excerpt:
// Potentially, we do not force an update of the physics data here (behind a CVar, as we don't necessarily need the
// information immediately in the editor and update will happen on cook or PIE) :
FinalizePhysicalMaterial(CVarLandscapeApplyPhysicalMaterialChangesImmediately.GetValueOnGameThread() != 0);
}
else
{
PhysicalMaterialTask.Tick();
}
}