Overview
WCGASEventSubsystem is a Game Instance Subsystem that provides centralized event broadcasting for Gameplay Ability System events. It bridges the gap between GAS's C++-centric architecture and Blueprint-focused designers, allowing them to respond to attribute changes, threshold crossings, and zero events without writing C++ code or creating custom Gameplay Abilities.
Purpose
The Event Subsystem empowers Blueprint-only designers by providing:
- Global Event Broadcasting: Fires delegates when any attribute reaches zero, crosses thresholds, or changes values across all ASCs
- Targeted Attribute Monitoring: Allows binding to specific attribute changes on specific ASCs for efficient production use
- Blueprint-Accessible Delegates: Exposes all events to Blueprint for easy implementation of UI updates, death logic, and warnings
- Automatic Memory Management: Uses weak object pointers and automatic cleanup to prevent memory leaks when actors are destroyed
- Multi-Listener Support: Enables multiple systems to respond to the same event without coupling them together
How It Works
Initialization Flow
- Subsystem Startup: When the GameInstance initializes, this subsystem automatically loads via Unreal's subsystem framework
- Delegate Setup: Initializes internal data structures for binding management in
Initialize()
- Ready for Binding: Blueprint and C++ code can now bind to global delegates or create targeted bindings
- Event Integration: WCGASAttributePool calls broadcast functions during attribute modifications
Broadcasting Flow
When attributes are modified:
- WCGASAttributePool detects attribute changes in
PostGameplayEffectExecute() or PreAttributeChange()