I have found that if a gameplay cue is entirely created by code, and no derived blueprint exists, it will never be run even though all the requirements are met. This is a little bit painful because the derived blueprint will just exist for this sake and may contain no customization.
UMyGameFloatingTextCueNotify::UMyGameFloatingTextCueNotify(const FObjectInitializer& Init) :
Super(Init)
{
// TODO: This needs to be placed in a blueprint class instead otherwise this causes OnExecute never being called
GameplayCueTag = MyGame::Abilities::Cues::FloatingTextTag;
}
bool UMyGameFloatingTextCueNotify::OnExecute_Implementation(AActor* Target, const FGameplayCueParameters& Params) const
{
using namespace Courage;
using namespace MyGame;
auto FloatingTextComponent = Target->GetComponentByClass<UMyGameFloatingTextRuntimeComponent>();
if (!FloatingTextComponent)
{
FloatingTextComponent = AddComponentNative<UMyGameFloatingTextRuntimeComponent>(Target, "MyGameFloatingTextRuntime");
FloatingTextComponent->FloatingTextClass = FloatingTextClass;
FloatingTextComponent->TextVerticalSpacing = TextVerticalSpacing;
FloatingTextComponent->TextVerticalOffset = TextVerticalOffset;
FloatingTextComponent->TextActiveTime = TextActiveTime;
}
FloatingTextComponent->SpawnFloatingText(Target, Params);
return true;
}
```
1 post - 1 participant