Download

UGameplayEffect* & TSubclassOf<UGameplayEffect> in Unreal Editor

Hello guys,

I am a bit confused, I need to make use of the function ApplyGameplayEffectToSelf(), which takes a UGameplayEffect* as its first argument.

So, in the header file, I have declared:


UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Ability", meta = (AllowPrivateAccess = "true"))
UGameplayEffect* RegenerationEffect;

But then I found that there is actually nothing for me to choose in the editor, as shown in the attached image (p.s. I did created a Blueprint Child Class of GameplayEffect.

Then, I am forced to make the variable to be a TSubclassOf, like this:


UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Ability", meta = (AllowPrivateAccess = "true"))
TSubclassOf<UGameplayEffect> RegenerationEffect;

And now I got my selection back in the editor windows like the 2nd image attached.

I just don’t understand what is the mechanism behind this? Anyone has idea on this?

Isn’t **TSubclassOf ** just a template class that provides UClass type safety, while we can still use the pointer variable?