I can’t figure this out, I am trying anything just to be able to get events to fire in blueprint from C++. I am 5 hours into this and nothing is working. Very frustrated.
Right now both events show up in a blueprint with parent class of AProjectGameMode , but I can not get them to fire when called.
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FBindableEvent);
UCLASS(minimalapi)
class AProjectGameMode : public AGameMode
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent, Category = "test", meta = (DisplayName = "C++ - test"))
void test1();
UPROPERTY(BlueprintAssignable)
FBindableEvent test2;
They are called from another class in which gameMode is a pointer to an AProjectGameMode object, and which can call other function in the AProjectGameMode class instead of the event classes just fine:
gameMode->test1();
gameMode->test2();
I am just trying to get one, either, to work, included both because I am doing something that must effect both so thought it could be relevant.
OK, so made some progress, I think the first two things weren’t working because I thought the event would fire without a direct reference to the blueprint in question. Still not sure exactly what is going on there.
UFUNCTION(BlueprintImplementableEvent, Category = "Menu System", meta = (DisplayName = "C++ - Test Widget Thing"))
void testCPPWidget();
Then I use the following code to call the function, where CurrentWidget is a pointer to a UUserWidget that is stored when a menu blueprint is brought forward as the active menu.
So do you need to store a reference to the blueprint via BeginPlay automatically calling a function to be able to fire an event later? Would make some sense, but why is that not explained anywhere if that is true? I think I am still not understanding something here.