Set an Arrayelement of an Array in an Array does not work [structs]

Hey :slight_smile:

I have two structs: A “Department”-struct and a “Team”-struct. A department can have multiple teams, so the department-struct contains an array of team-structs amongst other things. Also there can be multiply departments, so I have an array of departments.
All in all I have an array of structs (Ds) and each of these contains another array of structs (Ts).

At some point in my game I have to recalculate some of the variables of both the departments and their teams.
As seen in the attached screenshot, I have two for-each loops looping through the arrays and calling a function, which does my calculations.

At first I tried to work with references I give to the functions (so without the set array elem at the end), but it did not work, as well as my second idea with the set array elem call. It neither works to insert a new element.

The problem is, the variables I changed are not set in the array. They remain the default value I set in the details panel before compiling :frowning:

Until after my functions, everything is fine. The values are correct calculated and the updated structs are returned correctly (I checked with Print String). The only problem is setting them in the arrays.

Am I doing something wrong or are arrays of structs a little buggy in the current release? I found some threads about similar problems, but not exactly the same problem as mine.

Thanks in advance :slight_smile:

It seems like these two have had the same problem:
Thread 1
Thread 2

I did some further testing and the only problem seems to be the deeper array (Team array). Every action I try to perform on this array fails (adding an element, modifing, removing…). The outer array (department array) seems to work just fine.

I could split things up and remove the 2D-Array-thing but that would result in an ugly index-storing to know which Team belongs to which department. :confused: