I got this exception
when this line executes Cast(()->GetFirstPlayerController()->GetPawn());
inside ScoreNormal() which is added in Lambda. All of this is inside Actor
This pawn is 100% exist.
The problem is that it happens randomly. I mean not each time this line fires.
I’ve tried checking it with IsValid(), verify() macro and still got this exception.
Also, my timer has 10 seconds delay.
The way I made Lambda and timer
TimerDelegate.BindLambda([&]()
{
ScoreNormal();
});
if (()->GetTimerManager().IsTimerActive(ManagerRef->ScoreHandleToStop))
()->GetTimerManager().ClearTimer(ManagerRef->ScoreHandleToStop);
()->GetTimerManager().SetTimer(TimerHandle, TimerDelegate, ScoreBonusDuration, false);
ManagerRef->ScoreHandleToStop = TimerHandle;
What am i doing wrong?
PS I forgot to mention that I also destroy this actor after i call SetTimer