Integer Array showing "Multiple Values"

While modifying an integer array inside a struct, it does that bug.

Any modifications using the saved array in the struct results in a crash, and the array only shows that when saved, regardless of using SetMembers or Make.

(The struct is also saved in an array of other structs)

Hello ,

This seems like something that requires a particular setup and structure as I’m not having any luck reproducing any of what you’re mentioning. Could you provide code / blueprints / information on how this is set up so that I can try to reproduce this issue?

I can’t provide code that would help you, because the issue is quite dumb, but I can tell you the steps to reproduce it. It’s pretty simple actually.

  1. Create a struct with an array of Integer (this bug is also present with Floats)

  2. Create an array of this struct in a blueprint

  3. Populate it. The array in the struct needs to be empty, but I haven’t tested
    with it already filled with something.

  4. Modify the int array of multiple struct at the same time, saving them at the same index as before in the array. I used the same number for 3 of them at the same time.

  5. Now, when you try to access the int in the struct’s array, it crashes. If you access it by hand via the inspector/viewport, it says “Multiple Values” (Even though it’s a list and so it’s only one element selected) and you can’t modify it.

I’m using 4.13 last version.
I tried restarting the editor and my PC, bug still present. Tried verifying the engine’s files. Still present.

Thank you for that information but it seems a bit vague on step 4 and 5.

“saving them at the same index as before in the array” I’m not sure what you mean here. In Step 5, how would you go about trying to “access the int in the struct’s array”? Any particular int? Which struct? Is all of this being done at runtime or in the details panel? Are both your Struct and Int array listed as Blueprintable? Are they being added to the class through code or through the blueprint editor?

Here’s a screenshot of my final setup from what I understood from your steps:

That’s it, but you need to fill the struct’s array at runtime.
Accessing the int is done by blueprint, so as you did, no particular int, the struct in the array of the blueprint ( the one in your “New Var 0”), and it’s all done at runtime.
All of them are done trough blueprint.

There seems to be more than just that causing the bug. I’m currently investigating the cause of that.

I don’t find the exact way to reproduce it, but it’s always present on my real script. How can I give the project to you privately ? Should I PM you a link to download the project ?

That would be helpful. You can PM it to me on our forums which you can find [here][1]. I’ve also run into some weird results while trying to reproduce this. This particular setup is returning 0 for both the Value and the Index (the Index is expected) when it’s run. If I use a single struct instead of one that is part of a struct array, it works without a problem. I’ll need to look into this further.

Edit: I see why that wasn’t working now. Get functions in Blueprints return copies of the returned variable instead of a reference, so any changes afterwards are to a transient value, unless you expressly set the struct element.

Thank you for sending me the project. In interest of keeping as much information about your project out of this as possible, I’ll avoid using the actual names of your assets.

I was able to figure out what was crashing it, partially due to the crash being an Access Violation.

Take a look at your function that is meant to add more elements to the array that is coming up as “Multiple Values”. At the beginning of this, you’re setting the entire array to be set to just a 1 element array coming from the input, meaning that everything being set in this array is getting wiped. Getting rid of the “Then 2” execution pin off the Sequence will avoid doing this and, in turn, avoid the crash.

What was happening is that when you went back to access these values, they had been wiped and you ended up referring to a null value, causing an access violation.

Edit: Unrelated to the issue itself, but just for future reference; When sending a project, you can delete the Saved and Intermediate (and Build/Binaries if it’s there) folders to save a lot of space. This stuff can all be generated locally.

The problem is that that array is actually a local variable, and by unlinking it you just make it empty when it’s used, so this avoid the actual problem.

In theory, this should just add an integer to the array in the struct, the integer being added at “Then 2”. The array is sane, but when you store it, it’s not wiped, because I use a “Set Array elem” instead of removing it then readding it.

I think this is an issue with the escape characters in the array inside the structs, for ints and floats.

Just to prove the fact that the temporary array works, at the end of that chart, there is a loop used to return the value of it. When you do it with the thing that has just been stored, it crashes.

For example, when I use a simple integer instead of an array, it works fine.

I’ll also try using an array of structs made of one simple integer.

Quick recap :

-Simple integer works

-Array of integer doesn’t work

-Array of struct with integers doesn’t work

-Copying the array inside the struct when breaking the struct causes a crash

-If the array in the struct had been populated, it’s counted as Empty, and iterating over it securely yelds no result

-Prepopulating the array inside the struct changes nothing

-I’m not rewriting on the same thing at the same time, you didn’t see it was two differents types of structs

To me, it’s a bug. I would like to know how it’s fixable, and if it is, I tried so much things and it still wasn’t working. Redownload to see what I tried (Disconnect the array saving the array inside the struct, it’s an instant crash, even if it’s empty).

This bug already existed in previous versions, but seems to have been reintroduced with v4.13.2. I han’t this bug before.

Strangely enough, it seemed like that bug was caused by the name of the int array.
I first renamed it then moved it up; the array just couldn’t be filled.
Then I recreated the struct from scratch, replaced all the references, and it worked.

My problem is solved, but that bug isn’t.

Spoke too soon : The bug came back just when I created a new macro in my MacroLibrary.

Just add something to rebuild the struct to fix it, because the seem to just missaved.

That bug is really annoying.

It seems that the bug itself was reopened as well. Looking through the comments, it seems like it is actively being worked on but I’m not quite sure when it’ll be fixed. We may need to wait for that to be fixed to continue, if you think this is a symptom of that.