RealDocs

UActorComponent::OnCreatedFromReplication

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

Description

Called when this component is dynamically created on a client as a result of replication from the server. Analogous to PostInitializeComponents for replicated dynamic component creation.

Caveats & Gotchas

  • This is not virtual — you cannot override it in subclasses. Use the IInterface_ActorSubobject interface or BeginPlay callbacks for post-creation logic instead.
  • Only fires when the component is created dynamically through replication, not when it is created locally or placed in the level. Don't rely on it as a general initialization hook.

Signature

ENGINE_API void OnCreatedFromReplication()

Return Type

void

Example

Listening for dynamically replicated component creation C++
// UActorComponent::OnCreatedFromReplication is non-virtual and called by the engine.
// To run logic after a replicated component is created on a client, override BeginPlay
// and check the net role:
void UMyComponent::BeginPlay()
{
	Super::BeginPlay();
	if (GetOwner() && GetOwner()->GetLocalRole() == ROLE_SimulatedProxy)
	{
		// Component was replicated to this client — initialize client-side state
	}
}

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.