MinGlobalTimeDilation
MinGlobalTimeDilation
#Overview
name: MinGlobalTimeDilation
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 MinGlobalTimeDilation is to set the lowest acceptable global time dilation value in Unreal Engine 5. This variable is part of the game’s time management system, which controls the speed at which time passes in the game world.
The Unreal Engine subsystem that relies on this setting variable is the core Engine module, specifically within the game framework and world settings components. It is primarily used in the AWorldSettings class, which is responsible for managing various world-related settings.
The value of this variable is set in the AWorldSettings class, which is part of the Engine’s game framework. It is defined as a UPROPERTY with the ‘config’ and ‘EditAnywhere’ specifiers, allowing it to be configured in the project settings and edited in the Unreal Editor.
MinGlobalTimeDilation interacts closely with MaxGlobalTimeDilation, which sets the highest acceptable global time dilation. Together, these variables define the range within which the global time dilation can be set.
Developers must be aware that:
- This variable is used to clamp the lower bound of time dilation, preventing it from going below the specified value.
- It affects the entire game world and can impact gameplay, physics, and other time-dependent systems.
- The value is checked and enforced in various parts of the engine, such as when setting global time dilation through gameplay statics.
Best practices when using this variable include:
- Setting a reasonable minimum value that doesn’t break game mechanics or create unplayable scenarios.
- Ensuring that MinGlobalTimeDilation is always less than or equal to MaxGlobalTimeDilation.
- Being cautious when modifying this value, as it can have far-reaching effects on game performance and behavior.
- Using it in conjunction with MaxGlobalTimeDilation to create a safe range for time dilation adjustments.
- Considering the impact on physics simulations, animations, and other time-dependent systems when adjusting this value.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:183, section: [/Script/Engine.WorldSettings]
- INI Section:
/Script/Engine.WorldSettings
- Raw value:
0.0001
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/WorldSettings.h:815
Scope (from outer to inner):
file
class class AWorldSettings : public AInfo, public IInterface_AssetUserData
Source code excerpt:
/** Lowest acceptable global time dilation. */
UPROPERTY(config, EditAnywhere, Category = Tick, AdvancedDisplay, meta = (UIMin = "0", ClampMin = "0"))
float MinGlobalTimeDilation;
/** Highest acceptable global time dilation. */
UPROPERTY(config, EditAnywhere, Category = Tick, AdvancedDisplay, meta = (UIMin = "0", ClampMin = "0"))
float MaxGlobalTimeDilation;
/** Smallest possible frametime, not considering dilation. Equiv to 1/FastestFPS. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp:560
Scope (from outer to inner):
file
function void UGameplayStatics::SetGlobalTimeDilation
Source code excerpt:
if (TimeDilation != ActualTimeDilation)
{
UE_LOG(LogBlueprintUserMessages, Warning, TEXT("Time Dilation must be between %f and %f. Clamped value to that range."), WorldSettings->MinGlobalTimeDilation, WorldSettings->MaxGlobalTimeDilation);
}
}
}
}
bool UGameplayStatics::SetGamePaused(const UObject* WorldContextObject, bool bPaused)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:144
Scope (from outer to inner):
file
function void AWorldSettings::PostInitProperties
Source code excerpt:
}
if (MinGlobalTimeDilation < 0)
{
MinGlobalTimeDilation = 0;
}
if (MaxGlobalTimeDilation < 0)
{
MaxGlobalTimeDilation = 0;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:289
Scope (from outer to inner):
file
function float AWorldSettings::SetTimeDilation
Source code excerpt:
float AWorldSettings::SetTimeDilation(float NewTimeDilation)
{
TimeDilation = FMath::Clamp(NewTimeDilation, MinGlobalTimeDilation, MaxGlobalTimeDilation);
return TimeDilation;
}
void AWorldSettings::NotifyBeginPlay()
{
UWorld* World = GetWorld();