AActor::IncrementalRegisterComponents
#include "GameFramework/Actor.h"
Access: public
Description
Registers a limited number of this actor's components per call, spreading the work across multiple frames. Used by the level streaming system to avoid large per-frame spikes when loading a new level.
Caveats & Gotchas
- • Returns true only when all components have been fully registered; the caller must keep calling this in a loop (across frames) until true is returned.
- • Passing NumComponentsToRegister=0 registers everything in one call, which defeats the purpose of incremental registration and may cause hitches on actors with many components.
Signature
ENGINE_API bool IncrementalRegisterComponents(int32 NumComponentsToRegister, FRegisterComponentContext* Context = nullptr); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NumComponentsToRegister | int32 | Maximum number of components to register in this call. Pass 0 to register all remaining components. | — |
| Context | FRegisterComponentContext* | Optional context object that batches render state creation across multiple registration calls for efficiency. | nullptr |
Return Type
bool Example
Used by the level streaming system C++
// Level streaming tick — register up to 5 components per frame
FRegisterComponentContext Context;
bool bDone = false;
while (!bDone)
{
bDone = MyActor->IncrementalRegisterComponents(5, &Context);
// Yield to the next frame in real usage
}
Context.Process(); // flush batched render state Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?