Which class should I use if I want to store some settings

Let’s say that I want to store a few variables that will be created on game start and will be available in my game the whole time. Which class should I use?

Either GameMode if you want to keep them in this level session (gamemode gets recreated on every level change) or GameInstance for persistent

If you up to C++ you can make your own AWorldSettings, which contain varables that will be saved with the level and you can access it via Settings button in editor, all EditAnywhere properties will show there. Problem for you might have is fact AWorldSetting is not blueprintable and oyu need to create C++ class of it and also you won’t be able to access this class via blueprint as there no any blueprint node that can access it, you need to make your own nodes to do it

I always use GameInstance to persist variables across level changes on the local device.
Just keep in mind that GameInstance does not replicate anything across network so if you need it to do that, you’ll have to pass those values on to the GameState and have it do the sharing of the data across network. (use PlayerState instead of GameState if the info is specific to a player rather than to the state of the game).

It is not working as you said. I need class which constructor is calling once, not every time when I change map.

But I need to create them only once, I do not want to reset them with level change.

Then you probably want to use your own custom GameInstance.

Then GameInstance is for you :slight_smile: i said GameInstance for persistent. You might also try using config if you want since it sounds like you using C++

Ganeinstance creates once per run of the game. Game mode gets created once per level open