x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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.

Product Version: UE 4.7
Tags:
more ▼

asked Jun 13 '15 at 07:37 PM in Using UE4

avatar image

repwolfe
56 2 7 11

avatar image TheMainStark Jul 20 '16 at 06:56 AM

Did you ever find an answer to this?

avatar image Atheist91 Jul 20 '16 at 10:54 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question