Can’t bind to DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam. What can be a problem?
My code:
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSlotUpdateSignature, int, SlotIndex);
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class INVENTORYPLUGIN_API UInventoryComponent : public UActorComponent
{
GENERATED_BODY()
public:
UInventoryComponent();
void AddItem(AItem* Item);
UPROPERTY(BlueprintAssignable, Category = "Listeners")
FOnSlotUpdateSignature OnSlotUpdateDelegate;
};
From UInventoryComponent I can AddDynamic and Broadcast. But next I have Slot UUserWidget:
UCLASS(Blueprintable, BlueprintType)
class INVENTORYPLUGIN_API UInventorySlot : public UUserWidget
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Inventory")
void Update();
virtual void NativeConstruct() override;
UFUNCTION()
void OnSlotUpdate(int UpdatedSlotIndex);
};
In implementation I can’t do addDynamic:
void UInventorySlot::NativeConstruct()
{
Super::NativeConstruct();
const UInventoryComponent* Inventory = GetInventory();
if (!Inventory)
{
return;
}
Inventory->OnSlotUpdateDelegate.AddDynamic(this, &UInventorySlot::OnSlotUpdate);
}