RealDocs

UActorComponent::PreRegisterComponentWithWorld

function Engine Since 5.1
#include "Components/ActorComponent.h"
Access: public

Description

Pre-registers a component with a world as part of incremental level loading. Only called on components that return true from ShouldIncrementalPreRegister, allowing expensive setup to be spread over multiple frames.

Caveats & Gotchas

  • This is called before full registration (RegisterComponentWithWorld) and before the component is considered 'registered'. The component cannot be ticked or rendered while in the pre-registered state.
  • Do not call this manually from game code. It is invoked by the engine's incremental level streaming system. Override OnPreRegister or OnPreRegistered virtual callbacks if you need to hook into this phase.

Signature

ENGINE_API void PreRegisterComponentWithWorld(UWorld* InWorld)

Parameters

Name Type Description Default
InWorld UWorld* The world to pre-register the component with.

Return Type

void

Example

Override ShouldIncrementalPreRegister to opt in and hook OnPreRegister C++
bool UMyHeavyComponent::ShouldIncrementalPreRegister(UWorld* WorldContext) const
{
	return true; // Opt into incremental pre-registration
}

void UMyHeavyComponent::OnPreRegister()
{
	Super::OnPreRegister();
	BeginExpensiveAsyncSetup(); // Kick off work during pre-registration window
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.