Unable to set FGameplayTag as UPROPERTY or as function parameter of a UFUNCTION

As the title suggests it’s not possible for me set an FGameplayTag as a UProperty, in my case it’s a struct member.

Tried also have a UFUNCTION(BlueprintCallable) with a parameter of type FGameplayTag which works neither.

Example code:

USTRUCT(BlueprintType)
struct FStatData
{
	GENERATED_BODY()

	UPROPERTY(EditDefaultsOnly)
	FGameplayTag StatTag;
};

On compilation I get an error (sry for the german snippets in there but mainly english):

  Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class UScriptStruct * __cdecl Z_Construct_UScriptStruct_FGameplayTag(void)" (__imp_?Z_Construct_UScriptStruct_FGameplayTag@@YAPEAVUScriptStruct@@XZ)" in Funktion ""void __cdecl `dynamic initializer for 'public: static struct UECodeGen_Private::FStructPropertyParams const Z_Construct_UScriptStruct_FStatData_Statics::NewProp_StatTag''(void)" (??__E?NewProp_StatTag@Z_Construct_UScriptStruct_FStatData_Statics@@2UFStructPropertyParams@UECodeGen_Private@@B@@YAXXZ)".

UnrealEditor-MyProject.dll: [LNK1120] 1 nicht aufgelöste Externe

If the UPROPERTY is removed or the BlueprintCallable is removed compiling works.

When I try to create a similar struct in Blueprints via Editor it works with adding a gampelaytag as property.
But in my case I need that in CPP.

Is not allowed to have BP callable FGameplayTags defined in CPP or what is going on here?

Greetings!
I managed to reproduce your error.
You have 1 unresolved external.

SOLUTION:
You must add in your “NameOfModule.Build.cs” of your module

		PublicDependencyModuleNames.AddRange(
			new string[]
			{
                "GameplayTags", // ADD THIS LINE TO THE EXISTING ONES
				
			}
			);

EXPLANATION:
Probably the "GameplayTags" module is not available on your public dependancies and with adding the BlueprintCallable or UPROPERTY makes it public. There is the conflict.

Tip: The unreal unresolved external symbol the most of the times is something missing from “NameOfModule.Build.cs”

Hope I helped!

1 Like