Navigation
API > API/Plugins > API/Plugins/GameplayAbilities
Gameplay Effects Data needs to be versioned (e.g. going from Monolithic to Modular) Unfortunately, the Custom Package Versioning doesn't work for this case, because we're upgrading outside of the Serialize function. For that reason we want to store a UProperty that says what version we're on. Unfortunately that propagates from Parent to Child (inheritance rules) so to overcome that, we have a special UStruct that always serializes its data (so it will always be loaded, not inherited). Here is how to do that:
Return false in Identical (which effectively disables delta serialization).
Reset the value in PostInitProperties, thereby not using the inherited value on the initial preload.
Ensure the CurrentVersion field isn't marked up as a UPROPERTY to avoid automatic copying between parent/child.
Implement Serialize to ensure the CurrentVersion is still serialized.
| Name | FGameplayEffectVersion |
| Type | struct |
| Header File | /Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayEffect.h |
| Include Path | #include "GameplayEffect.h" |
Syntax
USTRUCT ()
struct FGameplayEffectVersion
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CurrentVersion | EGameplayEffectVersion | The version the owning GameplayEffect is currently set to | GameplayEffect.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool Identical
(
const FGameplayEffectVersion* Other, |
By always returning false here, we can disable delta serialization | GameplayEffect.h | |
bool Serialize
(
FStructuredArchive::FSlot Slot |
We must use a custom serializer to make sure CurrentVersion serializes properly (without markup to avoid unwanted copying) | GameplayEffect.h |