Saving statistics - any downside to saving all as FStrings?

I have a bunch of statistics to record and display for the player. Most of these would be int or floats, as they record things like distance traveled or number of times the player did something.

These get updated on autosaves and infrequently. There is about 50 individual variables.

The only time they all get read is to display in a menu, here:

If I make all of the variables FString type, then I can put all of the variable names in an array, loop through it to grab the variable contents and display them using a Get Variable by Name function.

This way I don’t have to setup the widget manually and also if i change the variables, all I have to do is update the array. I don’t have to go and match a bunch of variables with a select node or anything like that.

This is easy and flexible, but I just want to ask the community, do you expect any problems with such a setup? I have tested and converting the save game string to a float or int to change it at runtime, then converting back to a string to save, all seems to work without any issue.

  • one other thought to add is that the key thing is just that the variables are all of the same type. So perhaps making them all float might be better.

50 variables is nothing so probably doesn’t matter how you save them. :+1:

1 Like

haha, that’s what I kind of figured but figure it’s worthwhile to ask. THanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.