ForEachLoop DESTROYs Variables

I have NO Idea what is going on, but i am very frustrated right now.

I have a “ForEachLoop”, and it destroys the Content of my the Array when it gets it.

The Variables are OK and filled on the left side of the Loop, but they are all “out of bound” on the right side.

So the Loop practically destroys the content in the variables.

I can grab it directly from the array, and everything is fine.
I cant grab it with the Loop, because “Out of bounds” [0/0] - but it is NOT out of bounds.

So… waht do i do now, i cant do anything without that Loop.

I have no idea either with this picture or description:) I would print a string right before you run the loop and get the length of the array to make sure data is in it. If there is, then I would break the LayerStruct on the other side and for each item in the array, I would print a string with its values to make sure they are set. If all that is working you should be good. I do have one question, what is [0/0] In blueprints, you cannot get data from an array element using that. So if you put that in a get node it will never work…as far as I know…I have been wrong before.

with destroy you probably mean remove right?

keep in mind that for removing or destroying things out of an array you should make it an invert “for each loop”. because when you remove index 10 all other elements drop one down so you will eventually skip elements. after index 10 is away, index 11 goes to index 10. the loop will skip it then. but that’s probably not your problem, just keep it in mind.

This is what i did.
If i do that BEFORE the Loop, everything is ok. [I checked multiple times, EVERYTHING is correct and filled with Data]
If i do that AFTER the Loop, all Arrays inside the Struct are “Out of Bounds [0/0]”.

If i try to get the values from the Struct with a Loop, this happens: [And the Print-String behind it does not work too]

If i do it manually, lets say “Index 0” (since this is the first one that the Loop will try to get) this is what happens:

That clearly shows that the Arrays within that Struct are NOT [0/0], There are 512 Arrays, filled with 4 Arrays, and they are filled with 100 Values - everything is there, and ok.

Until i try to grab them automatically.

Something Engine-Related is “broken” (very much broken).

EDIT: It is reproducable, its an Engine Bug.
Does not work with the same layout in the Backup.
I am done with this ****.

As far I can know creating array struct with struct arrays in Blueprint isn’t good idea - this wasn’t even doable in earlier engine versions but maybe something was changed lately. You should put this to AnswerHub. ( "Set Array Elam" isn`t work at struct array - Programming & Scripting - Unreal Engine Forums )

But it works… in the Backup - it is exactly the same thing -.- i just changed everything around it.

i will try something…

EDIT: i Could grab one of the Engines Backups for that file, and they work. (and they are EXACTLY) the same -.-

I just want to know: “Why” did this stop working as intended?

My tip for you is to use C++ instead if using complicated operations on array struct. You can use Function Library that’s taking that array struct and make changes on it. It’s not that hard, really. For such things C++ is more like scripting language thanks to UE4 API.

I’m using C++ to store my variables and make more complicated operations. (it’s easier to read, faster to build and iterate) Blueprints is used only for flow, small and visual things.

I just gave up and deleted everything that belongs to this stuff - im done with it.

I am unable to use C++ even for the simplest things, so i need to use Blueprint.

One day i just will pay someone to do this ****, but for know… i am so **** mad at Epic Games for the Bugs with the Structs.

Why is that? You can’t install Visual Studio Community?

Blueprints are really big and Epic did great job letting designers to work on their game. Just be creative with structs :wink: