100 Widgets being added to scroll box

I have two scroll boxes being populated by arrays in PawnTemplate BP. The male and the female arrays both have 10 items. I checked this by printing the length of the array. The first one, the female scroll box works perfectly. The male scroll box creates 10 widgets correctly and then goes on to repeat these 10 widgets 10 times to until there is 100 widgets in the male scrollbox.

I’ve tried plugging the female array into the male scrollbox and the same thing happens, the female scrollbox works and the male scrollbox repeats the items in the array 10 times. I’ve also tried casting instead of using a BP Interface with the same results.

Please tell me what moronic thing I’ve done!

By the looks of things, you have a foreach loop going inside another foreach loop. My idea for fixing this would be to drag a line from the first foreach loops “Completed” and over to the male “Get Chicken Arrays” at the top, and then break the old line that went to that “Get Chicken Arrays”.

Hope you understand what I’m trying to say (still kinda new to UE4, as in I’ve only spent like 36’ish hours on it so far.)

Would have shown it in a blueprint but I’m not home at my desktop.

Each time a female chicken widget is made, all male chicken widgets are made.

There are several ways you can go about fixing this. One way is as Tobi mentioned, you make sure the females array completes before starting the male array by cutting off the connector from “Add Child” to “Get Chicken Array”.

Another way is to use a Sequence node. Make 0 go into “Get Chicken Array” for females and 1 go into males.

Hope it helps! :slight_smile:

Thank you so much! Its so obvious, but I just couldn’t see it. You saved my sanity.