What I am doing is in a c++ class I am broadcasting an event, and I want to “catch” it and act.
In my case, on my MyCharacter class, I have an inventory and I wanted to display this in a widget blueprint. This seems on the surface to be simple … like ye olde “health bar update”. I’m missing something, but I can’t seem to nail down what it is.
Any help would be appreciated.
/sr
The error:
No value will be returned by reference. Parameter ‘NewInventory’. Node: OnInventoryUpdated
Create Event Signature Error: Unable to find the selected function/event: ‘[None]’ - has it been deleted?
[2331.44] Compile of WB_InventoryWindow failed. 1 Fatal Issue(s) 0 Warning(s) [in 45 ms] (/Game/DungeonEscape/UI/WB_InventoryWindow.WB_InventoryWindow)
MyCharacter.h
...
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInventoryUpdated, TArray<FString>, NewInventory);
...
public:
UPROPERTY(BlueprintAssignable)
FOnInventoryUpdated OnInventoryUpdated;
MyCharacter.cpp
if ( Inventory.Contains(InventoryItem) )
{
// Broadcast to any that care ( such as blueprint widgets )
OnInventoryUpdated.Broadcast(Inventory);
return true;
}
The Blueprint ( in this case my inventory widget ) :
What I would have liked/expected was that I could catch the event in the blueprint and then do what I needed to do. In this case I was just attempting to log them. I can definitely verify that the event broadcast is being called. In this case I’m not able to catch.
I have reviewed this which seemed on the surface to be what I wanted. But it doesn’t seem to work.
