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 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.
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:
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.