Can not set data in arrays of user defined structures

If I have an array of a structure that contains it’s own array (of FOO variables let’s say), then accessing right element and using ‘add’ or ‘append’ on one of FOO arrays does not actually add to it. instead I have to create a temporary variable - initialise it, append array to it, remove element I want and then set it. It’s very messy.

Is there a better way or is this a bug?

Hey SirYakalot,

I’m not certain I understand your setup. Can you provide some images of what isn’t working or a test project for me to look at? Thanks!

Hi SirYakalot,

We haven’t heard back from you in a few days, so I am marking this post as resolved for tracking purposes. Please let me know if you can provide more details and we can continue looking into it. Thanks!

I am actually having this problem in 4.7 Preview 4. I Add to a Static Mesh Component array in my Data structure which is also an array. I then get Length of StaticMesh Array and it comes out as 0.
This also happens in Preview 5.

Hi gmc,

Can you show me your setup? Thanks!

Sure, here are some pictures!

Hey gmc,

I tested this in 4.7 Preview 5, but didn’t get same result. I set up a Structure with 2 StaticMeshComponent arrays. In a new Actor BP, I created a variable of that Structure type and gave it 1 element for its Default Value (which I left empty). Then I added a StaticMeshComponent in Construction Script, as you did, and added it to one of Struct’s arrays. When I got length, promoted it to a variable, and made variable public, it showed 1 when in level.

There are only two things I can think of that might be different. First, make sure you’re giving Structure variable a Default Value of at least 1 element, or there won’t be anything to add to. Second, GET node in 4.7.5 seems a bit different than yours, so that may have changed. I had to use Get node, then Break it to get each of its arrays.

Can you give this a quick test in a new project in 4.7 Preview 5, and let me know if you’re seeing something different? Thanks!

I reset this up in a new project and it still did not work, however, I just want to make sure of one thing, is Structure you made also an array? I tested my setup with a Structure that was NOT an array and that worked. (both of Structures have 1 element, but arrays inside structures have 0.)
Here are some more pictures:

I’m not certain I know what you mean. A Structure is a Structure, not an array. Do you mean variable inside BP, which has a type of that Structure? In that case, yes, I made variable an Array.

I might need to see a test project with it set up your way. Can you make a quick test-project and upload it somewhere for me?

Here you go! Project
There’s not much in it, so I just uploaded it here.

Just checking in to see if this is still being worked on! It has been 2 weeks with no reply to my preview post and I need this to be fixed because some my BPs are not working!

Hi gmc,

I apologize for delay in response. Between an extended hospital stay for me and recent snow days here in NC, I haven’t had much of a chance to look into project you sent.

I did check into it for a bit yesterday, however, and I’m seeing problem in your project. Oddly enough, my own test project is set identically to yours and does not display this behavior. I’ll take some time today to try to find difference. In meantime, can you confirm that this happens if you create a new struct and a new blueprint with same setup? Thanks!

I created same bp from scratch with latest engine update (4.7.1) and same problems were there.
Your in NC! I’m right next to you, TN! We have had a ton of snow here too!

Nice! I can’t wait till it’s fixed, so I can start working on my BP again!
And since this is not my Question I cannot set this back to an answer, oops!

Hey gmc,

I’m no longer certain why it worked in one project I was working with, but now even a new BP in that project will produce same bug. It looks like root cause of problem involves Add node not functioning properly in Construction Script for all cases. I have entered a bug report for developers (UE-11171), and I’ll post here as soon as I see any update on it. Thanks for your hard work, it was very helpful!

Yep, Epic HQ is in NC =)

Well, I know it’s probably not what you’re looking for, but if you can avoid doing it in Construction Script, same node setup will work on Begin Play. Otherwise, though it is a bit cumbersome, you can set up something like what SirYakalot suggested in his question as a workaround.

Don’t worry about Resolved status, we track that kind of thing here =)

I am now facing this issue in a non construction script in an almost identical setup. This is in 4.8 preview 4.

Setup of only these 4 nodes is enough to cause array to not being written.

Hi Frozenfire,

Are you able to reproduce this in a new project? Can you give me exact steps to do so? I haven’t been able to reproduce this in 4.8 Preview outside of Construction Script so far. Thanks!

I have probably same problem and I’ve managed to reproduce this on a clean project, outside of Construction Script. HERE is my bug report.