Very trimmed down version of my code below. It compiles but only OnAnyStatChanged shows up in Blueprints and any other that I explicitly define are there.
However, I’m wanting to be able to programmatically create delegates for specific ChangleStatValues per Stat that are assignable via Blueprints but I haven’t been able to figure it out.
Any help would be appreciated, let me know if you require more information
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "ReplComponent.generated.h"
class AActor;
// macro version of EStat
#define STAT_LIST(Action) \
Action(Health) \
Action(Shield) \
Action(Energy) \
Action(Stamina)
// macro version of EChangeableStatValues
#define STAT_VALUE_LIST(Action, StatName) \
Action(StatName, CurrentValue) \
Action(StatName, MaxValue) \
Action(StatName, MinValue)
#define DECLARE_STAT_VALUE_DELEGATE_PROPERTY(StatName, StatValueName) \
UPROPERTY(BlueprintAssignable) \
FOnStatChangedDelegate OnChanged##StatName##StatValueName;
#define DECLARE_STAT_VALUE_DELEGATES_FOR_STAT(StatName) \
STAT_VALUE_LIST(DECLARE_STAT_VALUE_DELEGATE_PROPERTY, StatName)
#define DECLARE_ALL_STAT_VALUE_DELEGATES STAT_LIST(DECLARE_STAT_VALUE_DELEGATES_FOR_STAT)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnStatChangedDelegate, EStat, Stat, EChangeableStatValues, StatValue, float, NewValue);
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class PROJECTNUNYA_API UReplComponent : public UActorComponent {
GENERATED_BODY()
public:
UReplComponent();
protected:
virtual void BeginPlay() override;
public:
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
DECLARE_ALL_STAT_VALUE_DELEGATES
UPROPERTY(BlueprintAssignable)
FOnStatChangedDelegate OnAnyStatChanged;
};