AActor::PostMigrate
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualoverride
Description
Called after this actor has been migrated between server instances or processes via the UE Remote Object Handle system. Override to re-establish references or state that depends on the new hosting context.
Caveats & Gotchas
- • PostMigrate is only compiled when UE_WITH_REMOTE_OBJECT_HANDLE is defined. Projects not using Unreal's experimental multi-server / server mesh features will never encounter this method.
- • The world context during PostMigrate may differ from the one the actor was originally spawned into — do not assume any cached world-dependent pointers remain valid.
Signature
ENGINE_API virtual void PostMigrate(const struct FUObjectMigrationContext& MigrationContext) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MigrationContext | const struct FUObjectMigrationContext& | Context describing the migration operation, including source and destination. | — |
Return Type
void Example
Re-acquire world-dependent references after migration C++
void AMyActor::PostMigrate(const FUObjectMigrationContext& MigrationContext)
{
Super::PostMigrate(MigrationContext);
// Re-cache subsystem reference now that we're in the new world
MySubsystem = GetWorld()->GetSubsystem<UMySubsystem>();
} See Also
Tags
Version History
Introduced in: 5.4
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?