Quantcast
Channel: General - Epic Developer Community Forums
Viewing all articles
Browse latest Browse all 9593

Gameplay Cue entirely setup by code do not get triggered.

$
0
0

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

Read full topic


Viewing all articles
Browse latest Browse all 9593

Trending Articles