Elements in Structure Array not being set in BP
The Array Add blueprint node does not work with vector arrays in Structures (specifically created inside the Editor through the Content Browser). I think my images verify this claim.
My first image illustrates that were attempting to add to a structure array. The 2nd demonstrates that after the Add function finishes, the added random unit vector actually wasn't added to the array - it's empty.
Am I doing something wrong? Or is this a bug?
asked Nov 11 '14 at 06:04 PM in Blueprint Scripting
Here is the solution we came up with. This may need to be altered depending on how you are planning to use it. The trick is you must set the array size before adding/setting the array elements.
I did this on a Event Begin Play in the Event Graph.
Then set the array elements in the Construction Script.
answered Nov 12 '14 at 09:07 PM
TJ V ♦♦ STAFF
I think it's still broken in 4.9 but I kind of see why, since we use the 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 the regular array operations even width arrays in arrays of struct (that's happening in the 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)
answered Sep 06 '15 at 08:06 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here