Navigation
API > API/Plugins > API/Plugins/PCG
The Runtime Generation Scheduler system handles the scheduling of PCG Components marked as GenerateAtRuntime. It searches the level for Partitioned and Non-Partitioned execution sources in range of the currently active UPCGGenSources in the level, and schedules them efficiently based on their UPCGSchedulingPolicy, creating APCGPartitionActors as necessary to support hierarchical generation.
APCGPartitionActors can be created/destroyed on demand or provided by a dynamically growing pool of actors. If enabled, the pool will double in capacity anytime the number of available PAs reaches zero.
Execution sources and partition actors created by the Runtime Generation Scheduler should be managed exclusively by the runtime gen scheduling system.
| Name | FPCGRuntimeGenScheduler |
| Type | class |
| Header File | /Engine/Plugins/PCG/Source/PCG/Public/RuntimeGen/PCGRuntimeGenScheduler.h |
| Include Path | #include "RuntimeGen/PCGRuntimeGenScheduler.h" |
Syntax
class FPCGRuntimeGenScheduler
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FPCGRuntimeGenScheduler
(
UWorld* InWorld, |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
FPCGRuntimeGenScheduler
(
const FPCGRuntimeGenScheduler& |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
FPCGRuntimeGenScheduler
(
FPCGRuntimeGenScheduler&& other |
RuntimeGen/PCGRuntimeGenScheduler.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FPCGRuntimeGenScheduler() |
RuntimeGen/PCGRuntimeGenScheduler.h |
Structs
| Name | Remarks |
|---|---|
| FGridGenerationKey | Grid size, grid coords, original source, local source. |
| FStreamingCompleteQueryKey | Local to TickQueueSourcesForGeneration, cached here for efficiency. |
| FTickQueueSourcesForGenerationInputs | Add constructor, get moves for the sets. |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bActorFlushRequested | bool | Requests to flush all actors are deferred so they can be handled at a known time during tick. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| BasePoolSizeLastFrame | uint32 | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| bCleanupScanRequired | bool | Triggers scanning components for cleanup. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| bContextDirty | bool | Whether Context needs to be refreshed. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| bNonSpatialCellFinishedStreaming | bool | We should hold back generation until the non-spatial cell is done streaming, which happens once when the level loads. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| bPoolingWasEnabledLastFrame | bool | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| bSuspendedForReplayScrub | bool | True while a network replay scrub is in progress. Prevents ticking until scrub completes. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| bTreatEditorViewportAsGenSourcePreviousFrame | bool | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| CachedPrimingInfos | TMap< TObjectKey< UPCGComponent >, TArray< FPCGVirtualTexturePrimingInfo > > | Maps original component to a cache of VT priming infos. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| CachedStreamingQueryResults | TMap< FStreamingCompleteQueryKey, bool > | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| ChangeDetector | PCGRuntimeGenChangeDetection::FDetector | Used to detect when world state (generation sources, cvars etc) have changed enough to warrant rescanning generation cells. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| Context | FPCGRuntimeGenContext | Meta-information about current context. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| CVarRefreshSink | TUniquePtr< FAutoConsoleVariableSink > | Fires OnCVarSinkFired once per frame when any CVar changes, grouping all changes in that frame. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| FramesUntilGeneration | int32 | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| GeneratedSources | TSet< FGridGenerationKey > | Tracks the generated execution sources managed by the RuntimeGenScheduler. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| GeneratedSourcesToRemove | TSet< FGridGenerationKey > | Tracks the execution sources which should be removed from the GeneratedSources set on the next tick. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| GenSourceManager | FPCGGenSourceManager * | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| GenSources | TSet< IPCGGenSourceBase * > | Local to member functions but hoisted for efficiency. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| GraphParamChangedEventHandles | TMap< TObjectKey< UPCGComponent >, FDelegateHandle > | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| OriginalExecutionSources | TMap< TObjectKey< UPCGComponent >, TObjectPtr< UPCGRuntimeGenExecutionSource > > | Maps an original PCG component to its runtime gen execution source. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| OriginalSourceBeingRegistered | const IPCGGraphExecutionSource * | Setting up a PA calls APCGPartitionActor::AddGraphInstance which later calls RefreshComponent, which can create an infinite refresh loop. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| PartitionActorPool | TArray< TObjectPtr< APCGPartitionActor > > | Pool of RuntimeGen PartitionActors used for hierarchical generation. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| PartitionActorPoolSize | int32 | PartitionActorPoolSize represents the current maximum capacity of the PartitionActorPool. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| SourcesToGenerate | TMap< FGridGenerationKey, double > | Mapping of execution source + coordinates to priorities - needed to compute max priority over all gen sources. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| Subsystem | UPCGSubsystem * | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| TimeToNextTick | double | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| TrackingManager | FPCGTrackingManager * | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| WatchedCVarLastValues | TMap< FString, FString > | Last observed string value per CVar name watched by any registered source. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| WorldPartitionSubsystem | const UWorldPartitionSubsystem * | RuntimeGen/PCGRuntimeGenScheduler.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void FlushAllGeneratedActors() |
Destroy all runtime gen partition actors (both generated and pooled). Executed in next tick. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| RuntimeGen/PCGRuntimeGenScheduler.h | |||
void OnOriginalComponentRegistered
(
UPCGComponent* InOriginalComponent |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
void OnOriginalComponentReplaced
(
const UPCGComponent* InOldComponent, |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
void OnOriginalComponentUnregistered
(
UPCGComponent* InOriginalComponent |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
void Tick
(
APCGWorldActor* InPCGWorldActor, |
RuntimeGen/PCGRuntimeGenScheduler.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddPartitionActorPoolCount
(
int32 Count |
Adds Count new RuntimeGen PAs to the Runtime PA pool. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void AddReferencedObjects
(
FReferenceCollector& Collector |
Add UObject references for GC | RuntimeGen/PCGRuntimeGenScheduler.h | |
void CleanupDelayedRefreshSources () |
Remove execution sources from the GeneratedSources set that have been marked for delayed refresh. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void CleanupLocalSources
(
const APCGWorldActor* InPCGWorldActor |
Cleanup all local execution sources in the GeneratedSources set. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void CleanupSource
(
const FGridGenerationKey& GenerationKey, |
Cleanup a execution source and remove it from the GeneratedSources set. | RuntimeGen/PCGRuntimeGenScheduler.h | |
APCGPartitionActor * GetPartitionActorFromPool
(
const FPCGGridDescriptor& GridDescriptor, |
Grabs an empty RuntimeGen PA from the PartitionActorPool and initializes it at the given GridSize and GridCoords. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void RefreshExecutionSource
(
IPCGGraphExecutionSource* InExecutionSource, |
Refresh a generated execution source. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void ResetPartitionActorPoolToSize
(
uint32 NewPoolSize |
Destroy all pooled partition actors and rebuild with the NewPoolSize. | RuntimeGen/PCGRuntimeGenScheduler.h | |
bool ShouldTick
(
double InDeltaTime |
Returns true if the scheduler should tick this frame. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void TickCleanup
(
const TSet< IPCGGenSourceBase* >& GenSources, |
Perform immediate cleanup on execution sources that become out of range. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void TickCVars
(
const APCGWorldActor* InPCGWorldActor |
Detects changes in RuntimeGen CVars to keep the PA pool in a valid state. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void TickQueueSourcesForGeneration
(
const FTickQueueSourcesForGenerationInputs& Inputs, |
Queue nearby execution sources for generation. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void TickRequestVirtualTexturePriming
(
const TSet< IPCGGenSourceBase* >& InGenSources |
Request any required virtual textures to be primed within the necessary generation radius. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void TickScheduleGeneration
(
TMap< FGridGenerationKey, double >& InOutSourcesToGenerate |
Schedule generation on execution sources in priority order. | RuntimeGen/PCGRuntimeGenScheduler.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FPCGRuntimeGenScheduler & operator=
(
FPCGRuntimeGenScheduler&& other |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
FPCGRuntimeGenScheduler & operator=
(
const FPCGRuntimeGenScheduler& other |
RuntimeGen/PCGRuntimeGenScheduler.h |