I have created a BlueprintNativeEvent which is being called correctly in the C++ code (tested by printing to the log) but it is never firing in the BP.
.h
UCLASS()
class MYPROJECT_API ASWHUD : public AHUD
{
GENERATED_BODY()
public:
ASWHUD();
UFUNCTION(BlueprintNativeEvent, Category="CustomEvents")
void DisplayPickupMessage();
protected:
virtual void test();
};
I originally tried using BlueprintImplementableEvent this also never fired. I switched to NativeEvent so I could print to the log to prove that the function was being called.
I found the answer after reading up more on how the engine worked. I had been making an assumption that a Blueprint created from a custom class was “of that class” rather than a child inheriting from it.
This meant that in my C++ where I had specified HudClass = ASWHud::StaticClass(); I had expected it to run the blueprint graph in what was actually a child class Blueprint. This was a massive oversight on my part.
My eventual solution was to specify the Blueprint Class was to be used as the HUDClass in my ASWGameMode.cpp