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 components 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.
Components and PartitionActors 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
(
FPCGRuntimeGenScheduler&& other |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
FPCGRuntimeGenScheduler
(
const FPCGRuntimeGenScheduler& |
RuntimeGen/PCGRuntimeGenScheduler.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FPCGRuntimeGenScheduler() |
RuntimeGen/PCGRuntimeGenScheduler.h |
Structs
| Name | Remarks |
|---|---|
| FGridGenerationKey | Grid size, grid coords, original component, local componnent. |
| FTickQueueComponentsForGenerationInputs | Add constructor, get moves for the sets. |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FStreamingCompleteQueryKey | TPair< FVector, float > | Local to TickQueueComponentsForGeneration, cached here for efficiency. | RuntimeGen/PCGRuntimeGenScheduler.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ActorAndComponentMapping | FPCGActorAndComponentMapping * | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| bActorFlushRequested | bool | Requests to flush all actors are deferred so they can be handled at a known time during tick. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| bAnyRuntimeGenComponentsExist | bool | Track the existence of runtime gen components to avoid unnecessary computation when there is no work to do. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| bAnyRuntimeGenComponentsExistDirty | bool | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| BasePoolSizeLastFrame | uint32 | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| bPoolingWasEnabledLastFrame | bool | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| bTreatEditorViewportAsGenSourcePreviousFrame | bool | 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 | |
| ComponentsToGenerate | TMap< FGridGenerationKey, double > | Mapping of component + coordinates to priorities - needed to compute max priority over all gen sources. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| FramesUntilGeneration | int32 | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| GeneratedComponents | TSet< FGridGenerationKey > | Tracks the generated components managed by the RuntimeGenScheduler. | RuntimeGen/PCGRuntimeGenScheduler.h | |
| GeneratedComponentsToRemove | TSet< FGridGenerationKey > | Tracks the components which should be removed from the GeneratedComponents 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 | |
| OriginalComponentBeingGenerated | const UPCGComponent * | 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 | |
| Subsystem | UPCGSubsystem * | RuntimeGen/PCGRuntimeGenScheduler.h | ||
| World | UWorld * | 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 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 CleanupComponent
(
const FGridGenerationKey& GenerationKey, |
Cleanup a component and remove it from the GeneratedComponents set. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void CleanupDelayedRefreshComponents () |
Remove components from the GeneratedComponents set that have been marked for delayed refresh. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void CleanupLocalComponents
(
const APCGWorldActor* InPCGWorldActor |
Cleanup all local components in the GeneratedComponents 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 RefreshComponent
(
UPCGComponent* InComponent, |
Refresh a generated component. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void ResetPartitionActorPoolToSize
(
uint32 NewPoolSize |
Destroy all pooled partition actors and rebuild with the NewPoolSize. | RuntimeGen/PCGRuntimeGenScheduler.h | |
bool ShouldTick() |
Returns true if the scheduler should tick this frame. | RuntimeGen/PCGRuntimeGenScheduler.h | |
void TickCleanup
(
const TSet< IPCGGenSourceBase* >& GenSources, |
Perform immediate cleanup on components 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 TickQueueComponentsForGeneration
(
const FTickQueueComponentsForGenerationInputs& Inputs, |
Queue nearby components 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 >& InOutComponentsToGenerate |
Schedule generation on components in priority order. | RuntimeGen/PCGRuntimeGenScheduler.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FPCGRuntimeGenScheduler & operator=
(
const FPCGRuntimeGenScheduler& other |
RuntimeGen/PCGRuntimeGenScheduler.h | ||
FPCGRuntimeGenScheduler & operator=
(
FPCGRuntimeGenScheduler&& other |
RuntimeGen/PCGRuntimeGenScheduler.h |