Sorry I wasn’t clear. The other errors I was getting were because the attribute getter and setter weren’t defined by the macro anymore. All I did was this:
// Uses macros from AttributeSet.h
//#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
//
// GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
//
// GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
//
// GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
//
// GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
Today I replaced these macros manually with the code and it compiled fine.
Here are the macros from the AttributeSet.h file:
#define GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
static FGameplayAttribute Get##PropertyName##Attribute() \
{ \
static FProperty* Prop = FindFieldChecked<FProperty>(ClassName::StaticClass(), GET_MEMBER_NAME_CHECKED(ClassName, PropertyName)); \
return Prop; \
}
#define GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
FORCEINLINE float Get##PropertyName() const \
{ \
return PropertyName.GetCurrentValue(); \
}
#define GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
FORCEINLINE void Set##PropertyName(float NewVal) \
{ \
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent(); \
if (ensure(AbilityComp)) \
{ \
AbilityComp->SetNumericAttributeBase(Get##PropertyName##Attribute(), NewVal); \
}; \
}
#define GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName) \
FORCEINLINE void Init##PropertyName(float NewVal) \
{ \
PropertyName.SetBaseValue(NewVal); \
PropertyName.SetCurrentValue(NewVal); \
}
I just replaced the macros with this code for each attribute and it compiled fine:
/** Current Mana, used to execute special abilities. Capped by MaxMana */
UPROPERTY(BlueprintReadOnly, Category = "Abilities", ReplicatedUsing = OnRep_Mana)
FGameplayAttributeData Mana;
//ATTRIBUTE_ACCESSORS(UDGAttributeSet, Mana)
static FGameplayAttribute GetManaAttribute()
{
static FProperty* Prop = FindFieldChecked<FProperty>(UDGAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED(UDGAttributeSet, Mana));
return Prop;
}
FORCEINLINE float GetMana() const
{
return Mana.GetCurrentValue();
}
FORCEINLINE void SetMana(float NewVal)
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if (ensure(AbilityComp))
{
AbilityComp->SetNumericAttributeBase(GetManaAttribute(), NewVal);
};
}
FORCEINLINE void InitMana(float NewVal)
{
Mana.SetBaseValue(NewVal);
Mana.SetCurrentValue(NewVal);
}
I’m just not sure why it went wrong. All these macros are autogenerated by UE.