Error with GameplayTargetData not found in ScriptStructCache

After upgrading to UE 4.24, projects using TargetData in GameplayAbilities from the GameplayAbilitySystem throw errors about the TargetData missing in the ScriptStructCache and clients are disconnected from the Server when a GameplayAbility using TargetData is activated.

LogAbilitySystem: Error: Could not find GameplayAbilityTargetData_SingleTargetHit in ScriptStructCache
LogAbilitySystem: Error: Could not script struct at idx 121
1 Like

Starting in 4.24, we are now required to call UAbilitySystemGlobals::InitGlobalData() once to populate the ScriptStructCache with the TargetData structs.

Fortnite calls it from the AssetManager class’s start initial loading function and Paragon called it from UEngine::Init().

I prefer to call it from UEngineSubsystem::Initialize() in a UEngineSubsystem child class. However, this may result in crashes if you use the UAbilitySystemGlobals GlobalAttributeDefaultsTables as that expects the EditorSubsystem to exist to bind to one of its delegates and that may not exist yet due to the order in which Subsystems are created. If this applies to you, you may want to consider calling UAbilitySystemGlobals::InitGlobalData() later like Fortnite in the AssetManager or perhaps in the GameInstance.

3 Likes