I have looked everywhere trying to figure this out, along with playing with code trying to get it to work. Might be really simple and i am just looking too much into it. My goal is to call a function from my game mode in my HUD class ie. trying to figure out how to change HUDs while game is running.
Question:
“How do you get the current GameMode and set it to a pointer so i can call my function?”
Note: I am calling this from a custom SCompoundWidget class. Goal is to call my function in my game mode from a button click and it will set the HUDClass variable of GameMode to a different HUD class.
When i click the button on my MainMenuHUD which the PlayGameClicked function is linked to. It displays the text “PlayGameClicked” and “Login” so it goes into the correct functions, but HUDClass won’t update and show my LoginHUD.
I don’t think you can change default HUD class during runtime (I may be wrong, devs will correct) and more appropriate way to change your current hud class for player is to use APlayerController::ClientSetHUD() function.