I’ve created a slider which allows me to set the FOV in my settings menu, it does it successfully.
However it only does it whenever I’m in a map itself. The value is retained dying/spawning as a different character. Though upon changing/exiting a map, server traveling to the lobby or closing the game. The value isn’t saved.
I think I have to work with a savegame slot here. However I’m not completely sure how I should go about this. Does anyone have an example as to how I can approach saving the FOV value and regaining it once any of the aforementioned happens?
With this blueprint setup I alter the value from my settings widget:
And with this simple function, I display the current value as a tooltip:
Thanks in advance!
In my game I save FOV to GameInstance, and to a save slot.
On BeginPlay(), the character gets reference to the GameInstance and calls LoadSetting() function, which loads the save from the slot and sets values to the Character’s camera.
The LoadSettings() function can additionally have a parameter of type MyCharacter (your character blueprint class), so that the Character could immediately set a reference to itself in GameInstance, but that’s optional, you can get reference to your character in other ways.
Thanks for the reply Tuerer. You meant something like this?
The above is now in my game instance btw. Suppose this is how I get the fov settings to load?
No, you have to make your own load function, where you load game from slot and get the FOV value that you saved.
Cool, thanks Tuerer.
Came up with something like this:
Only thing I have to figure out is why it isn’t instantly applied at spawn. But I’ll get around to that! The main thing is, the value is stored and saved!
You can try loading it from the character itself, this way you can save some resources by not using casting or communicating between classes.
I just described my setup, where I have a lot of values stores in GameInstance because I constantly address them, but if it’s just FOV, you can skip the middle man and do it all in your character class.