Get Current HUD from Outside GameMode

I have a function in my PlayerController class that needs to get the game’s current HUD and call a public function on that HUD. Specifically, I have an action bound to a key, and that key should toggle the visibility of the current HUD.

I tried to get the GameMode through GEngine->GetWorld()->GetAuthGameMode() since that contains the HUDClass itself, but the function returns null, and I think it’s because this is a networked multiplayer game.

What is the best way to get the current HUD, or the HUDClass from the GameMode?

AHUDClassName* TheHUD = Cast(TheController->GetHUD());

You will need to cast the GetHUD() return value if it is a custom HUD class and not the base AHUD. Also, seen as you need it in the controller, you can just call the GetHUD() function or simply use this->GetHUD();.