Why BlueprintNativeEvent is not being called on BP?

So I’m trying to make a BlueprintNativeEvent function in C++ and call it through code to execute it in BP.
The function:

void AddContainer(int32 indexOfContainerInInventory);

it in a class that extends UUserWidget, called UMainInvWidget.

I know it is being called from code because I made the AddContainer_Implementation print a message to the screen when called, and it prints the message. I also know that the BP is not null when I call the function because 1)UE4 doesn’t crash and 2) I can see the widget in PIE. And the BP is a child of UMainInvWidget.

So here’s the print from the BP:


Thanks in advance!

In the c++ code, did you call AddContainer_Implementation() or AddContainer(), because for me it worked when I called the function without the implementation. Also, try adding a const to the end of the declaration so it is AddContainer() const and Add_Implementation() const. This will make it a normal function instead of an event, and it may make it work.

For reference, here is the link I am using:
link text