RuntimeGeneration
RuntimeGeneration
#Overview
name: RuntimeGeneration
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 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of RuntimeGeneration is to control the runtime generation behavior of navigation data in Unreal Engine’s navigation system. It is an enumeration (ERuntimeGenerationType) that determines how and when navigation data should be generated or updated during runtime.
This setting variable is primarily used by the Navigation System module in Unreal Engine. It is referenced in the ANavigationData and ARecastNavMesh classes, which are core components of the navigation system.
The value of this variable is typically set in the constructor of ANavigationData or through editor properties. It can also be modified at runtime, but care should be taken when doing so.
RuntimeGeneration interacts with other navigation-related variables and systems, such as bRebuildAtRuntime_DEPRECATED (which it replaces in newer versions) and the overall navigation data generation process.
Developers should be aware that:
- Changing this value can significantly impact performance and behavior of the navigation system.
- Different values (Static, Dynamic, LegacyGeneration) have different implications for when and how navigation data is generated or updated.
- The choice of RuntimeGeneration mode can affect other systems that depend on navigation data, such as AI pathfinding.
Best practices when using this variable include:
- Choose the appropriate mode based on your game’s needs and performance requirements.
- Use Static for levels where navigation data doesn’t need to change at runtime.
- Use Dynamic when the environment can change during gameplay and navigation needs to adapt.
- Be cautious when changing this value at runtime, as it can have far-reaching effects on game performance and behavior.
- Consider the implications on multiplayer games, especially regarding network synchronization of navigation data.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2807, section: [/Script/NavigationSystem.NavigationData]
- INI Section:
/Script/NavigationSystem.NavigationData
- Raw value:
Static
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/PCG/Source/PCG/Public/RuntimeGen/GenSources/PCGGenSourceEditorCamera.h:11
Scope: file
Source code excerpt:
/**
* This GenerationSource captures active Editor Viewports per tick to provoke RuntimeGeneration. Editor Viewports
* are not captured by default, but can be enabled on the PCGWorldActor via bTreatEditorViewportAsGenerationSource.
*/
UCLASS(BlueprintType, ClassGroup = (Procedural))
class PCG_API UPCGGenSourceEditorCamera : public UObject, public IPCGGenSourceBase
{
GENERATED_BODY()
public:
/** Returns the world space position of this gen source. */
#Loc: <Workspace>/Engine/Plugins/PCG/Source/PCG/Public/RuntimeGen/GenSources/PCGGenSourceWPStreamingSource.h:9
Scope: file
Source code excerpt:
/**
* This GenerationSource captures WorldPartitionStreamingSources for RuntimeGeneration.
*
* UPCGGenSourceWPStreamingSources are created per tick and live only until the end of the tick.
*/
UCLASS(BlueprintType, ClassGroup = (Procedural))
class PCG_API UPCGGenSourceWPStreamingSource : public UObject, public IPCGGenSourceBase
{
GENERATED_BODY()
public:
/** Returns the world space position of this gen source. */
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavMesh/RecastNavMesh.cpp:3345
Scope (from outer to inner):
file
function void ARecastNavMesh::PostEditChangeProperty
Source code excerpt:
else if (PropertyChangedEvent.Property->GetFName() == NAME_RuntimeGeneration)
{
// @todo this contraption is required to clear RuntimeGeneration value in DefaultEngine.ini
// if it gets set to its default value (UE-23762). This is hopefully a temporary solution
// since it's an Core-level issue (UE-23873).
if (RuntimeGeneration == ERuntimeGenerationType::Static)
{
const FString EngineIniFilename = FPaths::ConvertRelativePathToFull(GetDefault<UEngine>()->GetDefaultConfigFilename());
GConfig->SetString(TEXT("/Script/NavigationSystem.RecastNavMesh"), *NAME_RuntimeGeneration.ToString(), TEXT("Static"), *EngineIniFilename);
GConfig->Flush(false);
}
}
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavMesh/RecastNavMesh.cpp:3378
Scope (from outer to inner):
file
function bool ARecastNavMesh::SupportsRuntimeGeneration
Source code excerpt:
{
// Generator should be disabled for Static navmesh
return (RuntimeGeneration != ERuntimeGenerationType::Static);
}
bool ARecastNavMesh::SupportsStreaming() const
{
// Actually nothing prevents us to support streaming with dynamic generation
// Right now streaming in sub-level causes navmesh to build itself, so no point to stream tiles in
return (RuntimeGeneration != ERuntimeGenerationType::Dynamic) || bIsWorldPartitioned;
}
bool ARecastNavMesh::IsWorldPartitionedDynamicNavmesh() const
{
return bIsWorldPartitioned && SupportsRuntimeGeneration();
}
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationData.cpp:145
Scope (from outer to inner):
file
function ANavigationData::ANavigationData
Source code excerpt:
, bCanBeMainNavData(true)
, bCanSpawnOnRebuild(true)
, RuntimeGeneration(ERuntimeGenerationType::LegacyGeneration) //TODO: set to a valid value once bRebuildAtRuntime_DEPRECATED is removed
, DataVersion(NAVDATAVER_LATEST)
, FindPathImplementation(NULL)
, FindHierarchicalPathImplementation(NULL)
, bRegistered(false)
, bRebuildingSuspended(false)
#if WITH_EDITORONLY_DATA
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationData.cpp:190
Scope (from outer to inner):
file
function void ANavigationData::PostInitProperties
Source code excerpt:
if (HasAnyFlags(RF_ClassDefaultObject))
{
if (RuntimeGeneration == ERuntimeGenerationType::LegacyGeneration)
{
RuntimeGeneration = bRebuildAtRuntime_DEPRECATED ? ERuntimeGenerationType::Dynamic : ERuntimeGenerationType::Static;
}
}
else
{
bNetLoadOnClient = FNavigationSystem::ShouldLoadNavigationOnClient(*this);
RequestRegistration();
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Public/NavigationData.h:549
Scope (from outer to inner):
file
class class ANavigationData : public AActor, public INavigationDataInterface
Source code excerpt:
/** Navigation data runtime generation options */
UPROPERTY(EditAnywhere, Category = Runtime, config)
ERuntimeGenerationType RuntimeGeneration;
/** all observed paths will be processed every ObservedPathsTickInterval seconds */
UPROPERTY(EditAnywhere, Category = Runtime, config)
float ObservedPathsTickInterval;
public:
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Public/NavigationData.h:616
Scope (from outer to inner):
file
class class ANavigationData : public AActor, public INavigationDataInterface
function ERuntimeGenerationType GetRuntimeGenerationMode
Source code excerpt:
public:
FORCEINLINE const FNavDataConfig& GetConfig() const { return NavDataConfig; }
FORCEINLINE ERuntimeGenerationType GetRuntimeGenerationMode() const { return RuntimeGeneration; }
virtual void SetConfig(const FNavDataConfig& Src) { NavDataConfig = Src; }
void SetSupportsDefaultAgent(bool bIsDefault) { bSupportsDefaultAgent = bIsDefault; SetNavRenderingEnabled(bIsDefault); }
bool IsSupportingDefaultAgent() const { return bSupportsDefaultAgent; }
NAVIGATIONSYSTEM_API virtual bool DoesSupportAgent(const FNavAgentProperties& AgentProps) const;