Hello everyone! I’m writing here because I’m facing an issue with FGameplayTagContainer and I’m not sure how to solve it.
First of all, I’ve declared and defined some GameplayTags in C++:
.h
UE_DEFINE_GAMEPLAY_TAG(TAG_Dock_Test, “RealityField.Dock.Test”);
.cpp
UE_DECLARE_GAMEPLAY_TAG_EXTERN(TAG_Dock_Test)
I have a Component created in C++ with the following property:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=“Settings”)
FGameplayTagContainer GameplayTags;
When I build and create an Actor, I then add this Component to it and I set it up:
And I can clearly see it when I instantiate it in the Map:
Then I save and up until here, everything is fine. However, as soon as I change Map, all tags from the instance are gone.
But I can still see them in the Blueprint Editor:
Even worse, if I close the Editor, not only do I lose all the tags in the instance, but even in the Blueprint itself:

What is happening here? Am I using FGameplayTagContainer in the wrong way? Am I missing something?
3dRaven
(3dRaven)
4
5.4 works fine. All tags save and load correctly in maps.
Base tags and instanced tag changes save.
Example
.h
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GameplayTagContainer.h"
#include "NativeGameplayTags.h"
#include "MyTagComponent.generated.h"
UE_DECLARE_GAMEPLAY_TAG_EXTERN(TAG_Dock_Test)
UE_DECLARE_GAMEPLAY_TAG_EXTERN(TAG_Dock_Test2)
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) , Blueprintable, BlueprintType)
class YOUR_API UMyTagComponent : public UActorComponent
{
GENERATED_BODY()
public:
UMyTagComponent();
protected:
virtual void BeginPlay() override;
public:
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
UPROPERTY(EditAnywhere)
FGameplayTagContainer GameplayTags;
};
cpp
#include "MyTagComponent.h"
UE_DEFINE_GAMEPLAY_TAG(TAG_Dock_Test, "RealityField.Dock.Test");
UE_DEFINE_GAMEPLAY_TAG(TAG_Dock_Test2, "RealityField.Dock.Test2");
UMyTagComponent::UMyTagComponent()
{
PrimaryComponentTick.bCanEverTick = true;
}
void UMyTagComponent::BeginPlay()
{
Super::BeginPlay();
}
void UMyTagComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
}
Just remember to add “GameplayTags” to your build modules