Hi, I’m trying to get some variables of my gamemode blueprint from my HUD, but seems like the “get game mode” box is returning an empty value on the HUD blueprint.
This is how I’m trying to access to the game mode, but the “cast failed” case is allways executing (and it prints nothing)
Well the “Get All Actors of Class” searches for all actors within the level. To find a gamemode blueprint there should be fairly hard so the for loop doesn’t have anything to go through.
I am fairly confused by the first way you tried to do this though since from what I see it should work.
You could try using Blueprint Interfaces. They are the second way to get a variable from BP A to BP B.
In the HUD blueprint should also be a node called “Get owning X” I’m not 100% sure if there is a gamemode node of those or if that’s only for the controller and character.
I am currently searching for an elegant solution for this matter, too. This is how I found your question here.
What I´ve learned so far: While the HUD is only executed on the client-side, the GameMode exists only on the server. Thus, it is not possible to get a simple reference in order to access the variables inside the GameMode BP. I guess Erasio is right and we need to use some sort of BP communication like interfaces.
I had the same issue and discovered that you need to access the instance of the gamehud (the gamemode only holds the class object, not the in game instance). This is found in the player controller.