UGameplayCueManager

Singleton manager object that handles dispatching gameplay cues and spawning GameplayCueNotify actors as needed

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

GameplayAbilities

Header

/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayCueManager.h

Include

#include "GameplayCueManager.h"

Syntax

UCLASS()
class UGameplayCueManager : public UDataAsset

Remarks

Singleton manager object that handles dispatching gameplay cues and spawning GameplayCueNotify actors as needed

Variables

Name Description

Public variable

bool

 

bAccelerationMapOutdated

Protected variable UProperty Transient

FGameplayCueObj...

 

EditorGameplayCueObjectLibrary

Public variable

bool

 

EditorObjectLibraryFullyInitialized

Public variable

FTimerHandle

 

EditorPeriodicUpdateHandle

Protected variable

TSharedPtr< FSt...

 

GameplayCueAssetHandle

Handle to maintain ownership of gameplay cue assets.

Protected variable UProperty Transient

TArray< TSubcla...

 

GameplayCueClassesForPreallocation

Classes that we need to preallocate instances for

Protected variable UProperty Transient

int32

 

GameplayCueSendContextCount

Number of active gameplay cue send contexts, when it goes to 0 cues are flushed

Protected variable UProperty Transient

TArray< UClass ...

 

LoadedGameplayCueNotifyClasses

Hardref to the gameplaycue notify classes we have async loaded

Public variable

TMap< FGCNotify...

 

NotifyMapActor

Public variable

FSimpleMulticas...

 

OnEditorObjectLibraryUpdated

Public variable

FSimpleMulticas...

 

OnFlushPendingCues

Broadcasted when ::FlushPendingCues runs: useful for custom batching/gameplay cue handling

Public variable

FOnGameplayCueN...

 

OnGameplayCueNotifyAddOrRemove

Protected variable

FOnRouteGamepla...

 

OnRouteGameplayCue

Protected variable UProperty Transient

TArray< FGamepl...

 

PendingExecuteCues

List of gameplay cue executes that haven't been processed yet

Protected variable UProperty Transient

TArray< FPreall...

 

PreallocationInfoList_Internal

Protected variable UProperty Transient

FGameplayCueObj...

 

RuntimeGameplayCueObjectLibrary

Public variable

FStreamableMana...

 

StreamableManager

Public variable

FGameplayCueTra...

 

TranslationManager

Constructors

Name Description

Public function

UGameplayCueManager

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Static

void

 

AddGameplayCue_NonReplicated

(
    AActor* Target,
    const FGameplayTag GameplayCueTag,
    const FGameplayCueParameters& Para...
)

Convenience methods for invoking non-replicated gameplay cue events.

Public function Static

void

 

AddReferencedObjects

(
    UObject* InThis,
    FReferenceCollector& Collector
)

Protected function

void

 

BuildCuesToAddToGlobalSet

(
    const TArray< FAssetData >& AssetD...,
    FName TagPropertyName,
    TArray< struct FGameplayCueReferenc...,
    TArray< FSoftObjectPath >& OutAsse...,
    FShouldLoadGCNotifyDelegate
)

Protected function

void

 

CheckForPreallocation

(
    UClass* GCClass
)

Protected function

void

 

CheckForTooManyRPCs

(
    FName FuncName,
    const FGameplayCuePendingExecute& ...,
    const FString& CueID,
    const FGameplayEffectContext* ...
)

The cue manager has a tendency to produce a lot of RPCs.

Public function Virtual

bool

 

DoesPendingCueExecuteMatch

(
    FGameplayCuePendingExecute& Pendin...,
    FGameplayCuePendingExecute& Existi...
)

Returns true if two pending cues match, can be overridden in game

Public function

void

 

DumpPreallocationStats

(
    UWorld* World
)

Prints what classess exceeded their preallocation sizes during runtime

Public function

void

 

EndGameplayCueSendContext()

Public function Virtual

void

 

EndGameplayCuesFor

(
    AActor* TargetActor
)

Force any instanced GameplayCueNotifies to stop

Public function Static

void

 

ExecuteGameplayCue_NonReplicated

(
    AActor* Target,
    const FGameplayTag GameplayCueTag,
    const FGameplayCueParameters& Para...
)

Public function

int32

 

FinishLoadingGameplayCueNotifies()

Public function Virtual

void

 

FlushPendingCues()

Send out any pending cues

Protected function Virtual

TArray< FStr...

 

GetAlwaysLoadedGameplayCuePaths()

Public function Static

UWorld *

 

GetCachedWorldForGameplayCueNotifies()

Public function

UGameplayCue...

 

GetEditorCueSet()

Public function Const

void

 

GetEditorObjectLibraryGameplayCueNotifyFilenames

(
    TArray< FString >& Filenames
)

Get filenames of all GC notifies we know about (loaded or not). Useful for cooking

Public function

TArray< UGam...

 

GetGlobalCueSets()

Will return the Runtime cue set and the EditorCueSet, if the EditorCueSet is available. This is used mainly for handling asset created/deleted in the editor.

Public function Virtual

AGameplayCue...

 

GetInstancedCueActor

(
    AActor* TargetActor,
    UClass* CueClass,
    const FGameplayCueParameters& Para...
)

Returns the cached instance cue. Creates it if it doesn't exist

Protected function

FPreallocati...

 

GetPreallocationInfo

(
    UWorld* World
)

Public function

UGameplayCue...

 

GetRuntimeCueSet()

Loading GameplayCueNotifies from ObjectLibraries

Protected function Virtual

TArray< FStr...

 

GetValidGameplayCuePaths()

Returns list of valid gameplay cue paths.

Public function Virtual Const

UWorld *

 

GetWorld()

Public function

void

 

HandleAssetAdded

(
    UObject* Object
)

Handles updating an object library when a new asset is created

Public function

void

 

HandleAssetDeleted

(
    UObject* Object
)

Handles cleaning up an object library if it matches the passed in object

Public function

void

 

HandleAssetRenamed

(
    const FAssetData& Data,
    const FString& String
)

Warns if we move a GameplayCue notify out of the valid search paths

Public function Virtual

void

 

HandleGameplayCue

(
    AActor* TargetActor,
    FGameplayTag GameplayCueTag,
    EGameplayCueEvent::Type EventType,
    const FGameplayCueParameters& Para...,
    EGameplayCueExecutionOptions Option...
)

Handling GameplayCues at runtime:

Public function Virtual

void

 

HandleGameplayCues

(
    AActor* TargetActor,
    const FGameplayTagContainer& Gamep...,
    EGameplayCueEvent::Type EventType,
    const FGameplayCueParameters& Para...,
    EGameplayCueExecutionOptions Option...
)

Handling GameplayCues at runtime:

Public function Virtual

bool

 

HandleMissingGameplayCue

(
    UGameplayCueSet* OwningSet,
    FGameplayCueNotifyData& CueData,
    AActor* TargetActor,
    EGameplayCueEvent::Type EventType,
    FGameplayCueParameters& Parameters
)

Handles what to do if a missing cue is requested.

Public function

void

 

InitializeEditorObjectLibrary()

Called from editor to soft load all gameplay cue notifies for the GameplayCueEditor

Public function

void

 

InitializeRuntimeObjectLibrary()

Called to setup and initialize the runtime library.

Protected function

TSharedPtr< ...

 

InitObjectLibrary

(
    FGameplayCueObjectLibrary& Library
)

Internal function to actually init the FGameplayCueObjectLibrary.

Public function Virtual

void

 

InvokeGameplayCueAddedAndWhileActive_FromSpec

(
    UAbilitySystemComponent* Ownin...,
    const FGameplayEffectSpec& Spec,
    FPredictionKey PredictionKey
)

Public function Virtual

void

 

InvokeGameplayCueExecuted

(
    UAbilitySystemComponent* Ownin...,
    const FGameplayTag GameplayCueTag,
    FPredictionKey PredictionKey,
    FGameplayEffectContextHandle Effect...
)

Wrappers to handle replicating executed cues

Public function Virtual

void

 

InvokeGameplayCueExecuted_FromSpec

(
    UAbilitySystemComponent* Ownin...,
    const FGameplayEffectSpec& Spec,
    FPredictionKey PredictionKey
)

Wrappers to handle replicating executed cues

Public function Virtual

void

 

InvokeGameplayCueExecuted_WithParams

(
    UAbilitySystemComponent* Ownin...,
    const FGameplayTag GameplayCueTag,
    FPredictionKey PredictionKey,
    FGameplayCueParameters GameplayCueP...
)

Public function Static

bool

 

IsGameplayCueRecylingEnabled()

Public function

void

 

LoadNotifyForEditorPreview

(
    FGameplayTag GameplayCueTag
)

Looks in the EditorObjectLibrary for a notify for this tag, if it finds it, it loads it and puts it in the RuntimeObjectLibrary so that it can be previewed in the editor

Public function Virtual

void

 

NotifyGameplayCueActorEndPlay

(
    AGameplayCueNotify_Actor* Acto...
)

Notify to say the actor is about to be destroyed and the GC manager needs to remove references to it.

Public function Virtual

void

 

NotifyGameplayCueActorFinished

(
    AGameplayCueNotify_Actor* Acto...
)

Notify that this actor is finished and should be destroyed or recycled

Public function Virtual

void

 

OnCreated()

Called when manager is first created

Public function Virtual

void

 

OnEngineInitComplete()

Called when engine has completely loaded, this is a good time to finalize things

Protected function

void

 

OnGameplayCueNotifyAsyncLoadComplete

(
    TArray< FSoftObjectPath > StringRef
)

Public function

FOnRouteGame...

 

OnGameplayCueRouted()

Protected function

void

 

OnMissingCueAsyncLoadComplete

(
    FSoftObjectPath LoadedObject,
    TWeakObjectPtr< UGameplayCueSet > O...,
    FGameplayTag GameplayCueTag,
    TWeakObjectPtr< AActor > TargetActo...,
    EGameplayCueEvent::Type EventType,
    FGameplayCueParameters Parameters
)

Public function

void

 

OnPreReplayScrub

(
    UWorld* World
)

Public function

void

 

OnWorldCleanup

(
    UWorld* World,
    bool bSessionEnded,
    bool bCleanupResources
)

Public function

void

 

PrintGameplayCueNotifyMap()

Public function Virtual

void

 

PrintLoadedGameplayCueNotifyClasses()

Public function Virtual

bool

 

ProcessPendingCueExecute

(
    FGameplayCuePendingExecute& Pendin...
)

Process a pending cue, return false if the cue should be rejected.

Protected function

void

 

RefreshObjectLibraries()

Refreshes the existing, already initialized, object libraries.

Protected function Virtual

void

 

ReloadObjectLibrary

(
    UWorld* World,
    const UWorld::InitializationValues ...
)

This handles the case where GameplayCueNotifications have changed between sessions, which is possible in editor.

Public function Static

void

 

RemoveGameplayCue_NonReplicated

(
    AActor* Target,
    const FGameplayTag GameplayCueTag,
    const FGameplayCueParameters& Para...
)

Public function

void

 

RequestPeriodicUpdateOfEditorObjectLibraryWhileWaitingOnAssetRegistry()

Calling this will make the GC manager periodically refresh the EditorObjectLibrary until the asset registry is finished scanning

Public function

void

 

ResetPreallocation

(
    UWorld* World
)

Resets preallocation for a given world

Public function Virtual

void

 

RouteGameplayCue

(
    AActor* TargetActor,
    FGameplayTag GameplayCueTag,
    EGameplayCueEvent::Type EventType,
    const FGameplayCueParameters& Para...,
    EGameplayCueExecutionOptions Option...
)

Actually routes the gameplaycue event to the right place.

Public function Virtual Const

bool

 

ShouldAsyncLoadMissingGameplayCues()

If true, this will asynchronously load missing gameplay cues, and execute cue when the load finishes

Public function Virtual Const

bool

 

ShouldAsyncLoadObjectLibrariesAtStart()

Protected function Virtual Const

bool

 

ShouldAsyncLoadRuntimeObjectLibraries()

Public function Virtual Const

bool

 

ShouldLoadGameplayCueAssetData

(
    const FAssetData& Data
)

Called before loading any gameplay cue notifies from object libraries.

Public function Virtual

bool

 

ShouldSuppressGameplayCues

(
    AActor* TargetActor
)

Returns true to ignore gameplay cues

Public function Virtual Const

bool

 

ShouldSyncLoadMissingGameplayCues()

Debugging Help

If true, this will synchronously load missing gameplay cues

Protected function Virtual Const

bool

 

ShouldSyncLoadRuntimeObjectLibraries()

Protected function Virtual Const

bool

 

ShouldSyncScanRuntimeObjectLibraries()

Public function

void

 

StartGameplayCueSendContext()

Start or stop a gameplay cue send context.

Public function

void

 

TranslateGameplayCue

(
    FGameplayTag& Tag,
    AActor* TargetActor,
    const FGameplayCueParameters& Para...
)

Allows Tag to be translated in place to a different Tag. See FGameplayCueTranslorManager

Public function

void

 

UpdatePreallocation

(
    UWorld* World
)

Prespawns a single actor for gameplaycue notify actor classes that need prespawning (should be called by outside gamecode, such as gamestate)

Public function

bool

 

VerifyNotifyAssetIsInValidPath

(
    FString Path
)

Classes

Name

Description

Public class

FOnRouteGameplayCue

Constants

Name

Description

CurrentWorld

Cached world we are currently handling cues for.

PreviewComponent

Animation Preview Hacks

PreviewProxyTick

PreviewWorld