Load/Save 2D Array of Enums

I have a bunch of Actors that each contain a TArray of a custom Enum class of mine. I would like these TArrays to be stored as a 2D Array in some sort of file. Ideally this file should easily editable. I’ve looked online / on the answerhub for various solutions to this issue.

  • USaveGame was one idea, but it had two downsides. I couldn’t store the TArrays into a nested TArray property (TArray>) because it’s not supported for some reason. As well it stores the properties in a binary file, and I’d rather a simple text file
  • JSON was another; make a JSON text file with the 2D Array that I can load / save. The issue with this is converting from a String to an Enum and vice versa, which I’ve seen is possible but tedious.

Of these two it looks like JSON is my best bet, but are there any other, easier ways? I don’t want to spend too much time on this.

Thanks!

PS - The reason I want to do this is because I’m creating these Actors dynamically in code, and any changes I make to their properties in the Editor are not retained the next time the level is loaded. If you can explain to me how to do resolve that in a way that doesn’t require me to save to a file, please let me know. Right now the only thing I can think of is make changes in the Unreal Editor and save the results to a file. I’d rather not hardcode it.

Did you ever find an answer to this?

IMO using USaveGame would be an easier solution. As for the issue that it doesn’t allow you to store TArrays of TArrays you could simply wrap one array with struct.

So you’d have a struct FArrayOfEnums (it would contain single property TArray).

And then you’d have TArray and that would work properly.