So I’ve been working with delegates for the first time, and my code doesn’t work. I have no idea why so I thought maybe here I could get an answer. The compile always completes, but when I want to play and test this, my engine crashes. It crashes on this bit:
void AGoKartPhysics::BeginPlay()
{
Super::BeginPlay();
BoostBox2->BoostBoxEntered.AddDynamic(this, &AGoKartPhysics::BindToDelegateBoost);
}
BoostBox2 is declared as follows:
ATriggerBox2* BoostBox2 = Cast<ATriggerBox2>(GoKart);
Where GoKart comes from this:
AGoKartPhysics* GoKart;
BoostBoxEntered comes from this:
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBoostBoxEntered, bool, BoostBoxEnteredActive);
and this:
UPROPERTY(BlueprintAssignable)
FBoostBoxEntered BoostBoxEntered;
BindToDelegateBoost is the receiving void:
UFUNCTION()
void BindToDelegateBoost(bool BoostBoxEnteredActive);
This is everything I know, or I think I know, as I’m quite new to C++ and everything.
I hope sincerely someone can help me with this. Thanks in advance!