Set Members In Struct node does not work

This problem is far larger than devs imagine. primary use case for structs is as individual data records in a list. And, when an array is not original source of data, but (theoretically) a list of references to original records, no amount of hacking can possibly work around issue.

For example, in my case, I can’t even use the “make struct” workaround. I have a bunch of struct records and a function that searches through these based on given search parameters and returns an array containing found records. I need to then modify those records, but I can’t. Setting one of array items returned by search function wouldn’t affect original record; they would only affect temporary search results array returned by search function.

I have tested this in 4.7.5, and it still isn’t working unfortunately.
Here is a screen of a simple setup. It should print "something else, but prints “no title”. If I make a clean struct and set array elem with that, then print is correct.

Can anyone from Epic chime in? It seems wonky that this bug has persisted for 9 months, through 4 updates.

Hi and DekanTrue,

We have made numerous fixes to structs and arrays in past few updates but this particular issue is still being investigated by our developers.

We’ll post back here when there is a status change.

Cheers,

TJ

Just ran into this too, pretty horrible because ti makes you think you’re doing something wrong when apparently no amount of fixing can resolve issue.

Hopefully they can get it fixed soon, it’s sort of functionality that gets used a ton so it’s hard when it’s buggy.

Tried im 4.8 preview 4, not fixed sadly.

Is this still broken? I’m still using 4.7.6 and just found out about this problem.

Can you please give us an update on this? I just tested it in 4.8 and it is still broken.

Edit: removed some extraneous info on further testing. It is still broken though.

Thank you

Nothing new to report at this time.

Can confirm, as of July 28th, 2015, this is still broken. Changing data in an array of structures does not work.

Majorly bummed out about this. Will have to halt production until it is fixed.

They could fix this one issue and call it 5.0, cause that’s how big of a deal it is. It literally is a bigger issue then anything else. Being able to have structures in an array and being able to change data in those structures contained within structure array is imperative, like outright engine breaking not to have.

Just make a new instance of struct, copy old data into it along with your changes, and replace old one in array. It’s a long path, but it’s not impossible.

Actually I already did all that. Took me, well, 3 hours I guess. Just finished reworking it. Major hassle to have to go through tho over a function not working. See, I had arrays inside of structures inside of arrays, it was quite challenge.

It wouldn’t be a big deal except that Blueprint is supposed to be a drop in replacement for a traditional scripting language. Having to either put up with pretty severe bugs in BP or learn C++ AND a very large API is kind of a tough spot to be in quite honestly. I just have a hard time understanding why new features are constantly being added but things like this bug can exist for nearly a year.

Don’t get me wrong 99% of BP is pure gold, but show stoppers are, well, showstoppers.

Blueprint is indeed awesome. I came into it from a scripting background and I absolutely love it.

That being said, this particular bug did require me to set up these ridiculously big and long functions to break down structures, arrays, etc and then put them back together again using Add Indexes and Remove Indexes, etc. just to do what one little function could have done all through one node.

At first when I came across this bug it was a total heart sink because I knew how big of a deal it was. My initial response kind of blew it out of proportion because of complexity of my current project, I knew that broken function was gonna cost me a day of scripting just to work around it. Like OhiraKyou responded to me, it’s not impossible, just a long path. Long paths are very expensive time wise and as such very expensive to developers.

I can say that I will be watching for as well as looking forward to seeing this issue resolved. I managed to work around it, but man, it was a royal pain and fried meh brain. But meh, getting really deep into arrays of arrays of arrays has always fried meh brain even before blueprint.

Im using 4.8 and also have same problem.
insert trick up in this thread works.

Hello,

I think it’s still broken in 4.9 but I kind of see why, since we use the “get” node, we declare our operations as “I’m not gona modify this value, just read it”. So it’s logical why does it not work.

With this soulution below, you can set any elements of a struct, and use all regular array operations even width arrays in arrays of struct (that’s happening in image).

Just remember, never try to modify something you get out of a “get” node and you will be fine. (of course only if structs are involved :P)

I like recent train of thought about never modify something you “Get”. However, this is still confusing. When you Get an object out of a list you can’t use that object to modify list. Doing:

asdf = list.Get(1);
asdf = "MyNewValue";

Won’t set list index 1 to “MyNewValue”.

asdf = list.Get(1);
asdf.setFirstName("tebruno99");

This will set first name of object in list index 1 to “tebruno99” but didn’t modify list.

I think this is where confusion is coming from especially since object in this case is an instance of a struct designed to hold modifiable data.

struct {
  String firstName;
  String lastName;
} person;

Person me = new person;
person.firstName = "Mark"
person.lastName = "Hogger"
list.set(8,me);
list.get(8).lastName = "Flogger"

I think it is completely reasonable for get to modify an internal value of struct, get should not modify list itself.

As I’ve said before here, structs are primarily used as individual data records in a list. And, when array represents search results returned by a function, this completely falls apart; there’s no reasonable way to set original. You can keep some unique identifier in struct and call another function to search through original array to find struct with that identifier, but that can lead to a lot of unwieldy, bug-prone code that’s hard to debug and maintain.

Yep - current issue leads to some really inelegant approaches, it would be much better if it just were fixed to work way it should.