Course contentsShow
← Unreal Engine Game Development
Lesson 680 of 8809. Gameplay Ability System (GAS)Free lesson

Architecting Gameplay Cue Notify Static Classes

Develop static gameplay cue classes to handle lightweight, non-instanced effects that improve performance for simple environmental or impact feedback.

In this lesson, you will learn how to leverage UGameplayCueNotify_Static classes to execute high-performance, lightweight visual and audio feedback without the overhead of instanced objects.

Why Use Static Cues?

When you trigger a Gameplay Cue that doesn't need to persist or hold complex internal state—such as a simple impact sound, a particle burst on a wall, or a brief screen shake—creating a full GameplayCueNotify_Actor is wasteful. An Actor version creates a new object instance in the world, consuming memory and processing cycles.

UGameplayCueNotify_Static is designed specifically for these transient effects. Because it is non-instanced, the engine maintains a single shared instance for the class type. When the Cue is triggered, the engine simply calls the class functions directly, making it significantly more performant when firing hundreds of cues in a dense combat scenario.

Implementation Pattern

Because these classes are static, you do not use BeginPlay or Tick in the traditional sense. Instead, you override event functions provided by the base class. These functions receive a FGameplayCueParameters struct, which contains all the contextual data you need, such as the EffectCauser, Target, and the Location of the impact.

// Example: Simple Static Cue for an Impact
UCLASS()
class UMyStaticImpactCue : public UGameplayCueNotify_Static
{
    GENERATED_BODY()

    virtual bool OnExecute_Implementation(AActor* MyTarget, const FGameplayCueParameters& Parameters) const override
    {
        // Execute logic immediately
        UGameplayStatics::SpawnEmitterAtLocation(MyTarget, ImpactParticle, Parameters.Location);
        UGameplayStatics::PlaySoundAtLocation(MyTarget, ImpactSound, Parameters.Location);
        
        return true; // Return true to indicate the cue was handled
    }
};

Best Practices

  1. Keep it Stateless: Since the class instance is shared globally, never store variable state (like timers or counters) on the class itself. If you need to track state over time (e.g., a looping fire effect), use GameplayCueNotify_Actor instead.
  2. Context is Key: Always rely on the FGameplayCueParameters struct to pull the Location or Normal of the impact. This allows your static class to remain generic and reusable across different materials or surfaces.
  3. Handle Returns: Ensure you return true from your OnExecute or OnActivate overrides so the Gameplay Cue system knows the logic finished successfully.

Key Takeaway: Use UGameplayCueNotify_Static for "fire-and-forget" effects to maximize performance by avoiding the overhead of instantiating Actors for simple, stateless feedback.