RealDocs

AActor::GetAttachmentReplication

function Engine Since 4.12
#include "GameFramework/Actor.h"
Access: public Specifiers: const

Description

Returns a const reference to the `FRepAttachment` struct that the engine fills in when this actor's root component is attached to another actor, used to replicate attachment state to clients.

Caveats & Gotchas

  • This struct is populated by `GatherCurrentMovement()` automatically each frame when the actor is attached. Do not modify it directly — attach/detach via the standard `AttachToActor`/`AttachToComponent` API instead.
  • The returned reference is to an internal replicated UPROPERTY. It becomes invalid if the actor is destroyed, so never store it past a single frame.
  • Inspecting this value is primarily useful for advanced replication debugging or when writing a custom net driver extension.

Signature

const struct FRepAttachment& GetAttachmentReplication() const { return AttachmentReplication; }

Return Type

const struct FRepAttachment&

Example

Log attachment replication data for debugging C++
void AMyActor::DebugAttachment() const
{
	const FRepAttachment& Rep = GetAttachmentReplication();
	if (Rep.AttachParent)
	{
		UE_LOG(LogTemp, Log, TEXT("Attached to %s, socket %s"),
			*Rep.AttachParent->GetName(), *Rep.AttachSocket.ToString());
	}
}

Version History

Introduced in: 4.12

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.