Access GameModeBase from AnimNotify in C++

I guess the only thing that can crash the engine here is if GetWorld() returns nullptr. Check if it is valid, and only then call GetAuthGameMode().

Hello.

Access a GameModeBase from an AnimNotify, in C++

This works when I access fron an Actor :
AMyGameModeBase* GameMode = Cast (GetWorld ()->GetAuthGameMode ());

But when I try, with the same code, to access my GameModeBase from an AnimNotify class, UE crashes.

Does anyone knows how to do ?

Thank you.

Thank you. You gave me another idea for looking for.
AGameModeBase1* GameMode = Cast (**MeshComp->**GetWorld ()->GetAuthGameMode ());
Now, it works !