The above image shows the main menu, which is a blueprint widget. There are five variables that are set in the menu: game speed, block count, wall height, level count and a bool variable that tracks if the game mode is play mode or build mode. These variables are set with sliders, and when “Build Mode” or “Play Mode” buttons are pressed, these variables are supposed to set the corresponding variables inside the GameMode.
This is the “On Clicked” event of the play mode button. The event gets the values of the sliders, and uses the “SetGameModeValues()” BlueprintCallable function to set the game mode variables.
SnarisGameMode.h (1.6 KB)
This is the .h file of the parent class of my BP_SnarisGameMode
SnarisGameMode.cpp (686 Bytes)
This is the .cpp file of the parent class of BP_SnarisGameMode
Here is the problem:
The variables of the game mode class that were to be set to the values determined inside the main menu are not changed, and the default values set in the c++ constructor remain unchanged.
The above image shows the tick event of the BP_SnarisGameMode printing the “BlockCount” variable, and the value is the default value.
Also printing the result from the SnarisGameMode.cpp file’s tick function, the variables are unchanged.
How can I set the game mode variables to the values determined in the Main Menu widget blueprint?