Download

Need help setting a variable in game mode BP via a menu BP

Ok, so, I’m a 3D artist and I have a game concept working kinda alright.
But, I have an issue.
I order to create local multiplayer I followed a tutorial that helped me create a variable, an e_num, called NumberOfPlayersInGame.
It works great in the GameMode BluePrint. I can change the number of players via a roll down menu.

a230a19022d153701907c82f3da5655f9aa9ef11.jpeg

But now I’m trying to create a menu, and have that menu BluePrint tell the GameMode BluePrint what to use.
In my head it feels like I should have to cast to the GameMode BP and set the value of the NumberOfPlayersInGame variable.

660b254b14dc216c37049c1583f207f3126219c3.jpeg

Buuut I clearly have no idea of what I am doing. It’s like it doesn’t even react to me casting to it.

Can anyone tell me what I would have to do in order to use my menu widget BP to tell the GameMode what default setting to use in the BP?

I have the same problem but the opposite way around. I need to call my game mode variable to my blueprint. I can’t seem to figure it out.

I’m not quite sure I understand your goal here. Is your problem, that if you selected your PlayerAmount and start the game, the variable is reset to default?
If so, you should understand, the GameModeBase is not persistent through levels, you should rather store your variable in the GameInstance (which is persistent) and then grab it from there.
You can get it the same way you get it from the GameMode, “get gameinstance” -> “cast to your gameinstance” -> “get Number Of Players in Game”
Hope I could help ^^