How do you replicate a gameplay tag container?

I’m trying to replicate a gameplay tag container in an actor in C++.

In the header file I have this.

UPROPERTY(Replicated)
FGameplayTagContainer TagContainer;

In the cpp file I have this.

void AMyActor::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);

	DOREPLIFETIME(FGameplayTagContainer, TagContainer);
}

But the compiler gives me these errors.

error C2039: 'StaticClass': is not a member of 'FGameplayTagContainer'
error C2248: 'FGameplayTagContainer::TagContainer': cannot access protected member declared in class 'FGameplayTagContainer'

What does this mean? I know I can replicate a gameplay tag container inside a Blueprint actor without an issue, so how do I do it in C++?

Oops, I made a mistake. It’s supposed to be like this.

DOREPLIFETIME(AMyActor, TagContainer);
1 Like