C++ Event Broadcasting + Blueprint receiving not working ( probably something simple )

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.

you got a couple of options

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInventoryUpdated, const TArray<FString>&, NewInventory);

  1. const ref should work
  2. wrap it in a struct, this has benefits of adding other values like inv name etc
  3. dont pass it at all, you have the hard ref to the class/component already so just call inv changed and pull the inv from the actor

I tried the const ref, which I thought was brilliant, as I knew I was missing something. I pulled my hair out for an hour because I had disconnected the bind event pin and didn’t notice.

Anyway, thank you so much, this was exactly the information I needed.

Much appreciated!