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"

How to save an Array?

Hi. I am trying to save an Array. It does save one value. But in doing so it resets all the other Int Values in the array back to 0.

What i am trying to achieve is write the current levels score to the array that is save. It does work in the sense that it saves the current level score. But when it does save it, it resets all the other Index to its default which is 0.

Any help would be appreciated. I followed tutorials on youtube about saving multiple actors but somehow what was done there i cannot translate correctly to my setup.

Perhaps due to a lack of understanding.

Image of blueprint

Product Version: Not Selected
more ▼

asked Aug 13 '14 at 09:35 AM in Using UE4

avatar image

417 25 37 53

avatar image Ethan Aug 13 '14 at 11:52 AM

In my short knowledge in your blueprint sequences you always set all the each value in "Level Score Reference" with "Level Score" of Target(may be SaveGame) (Maybe copying not referencing)

Check out all the each value in "Level Score" of Target before "Set Array Elements"

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

1 answer: sort voted first

Are you using a foreach loop to get each array entry in your blueprint to update to the array in the savegame?

Before save to slot, check the source array in your blueprint isn't empty (Length !=0) and if it isn't, make sure the savegame array is cleared (using Clear array function). Then foreach member of the blueprint's array, Add it to the savegame array, then do save to slot. If the source array in your blueprint actually is empty, there's no point to save that array, but you still need to decide whether to clear the saved array so that it matches with the current gamestate.

If you need to be sure that the entries are in the exact order in both arrays, try usng Set Array Element which lets you pass in the index value, and has a Size to Fit tickbox.

more ▼

answered Aug 13 '14 at 11:50 AM

avatar image

1.2k 46 47 89

avatar image C-Arch Aug 13 '14 at 12:59 PM


Apologies. I wanted to delete this question just now and saw you guys posted. Ethan and Tomofnz

I did find my issue. The reason my array was not saving is because i had a event begin play create save game object in my blueprint. Noob mistake i know.

This overwrote my savedgame information.

This tutorial helped me a lot. link text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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