RealDocs

UActorComponent::ReadyForReplication

function Engine Since 5.0
#include "Components/ActorComponent.h"
Access: public Specifiers: virtual

Description

Called on replicated components when their owning actor is officially ready for replication. Fires after InitializeComponent but before BeginPlay, and is the correct place to register replicated subobjects you already own.

Caveats & Gotchas

  • A component can be replicated before HasBegunPlay() is true — an RPC called during BeginPlay may trigger replication before this fires on the receiving end.
  • Requires the component to be registered, initialized, and have bReplicates set to true. If any of those conditions is not met, this method will never be called.
  • Use IsReadyForReplication() to query the bIsReadyForReplication flag if you need to guard work elsewhere in the component.

Signature

ENGINE_API virtual void ReadyForReplication()

Return Type

void

Example

Registering a replicated subobject C++
void UMyComponent::ReadyForReplication()
{
	Super::ReadyForReplication();
	// Register an already-created replicated subobject
	if (IsUsingRegisteredSubObjectList() && IsReadyForReplication())
	{
		AddReplicatedSubObject(MySubObject);
	}
}

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.