Developer Notes

Operating on a copy of the struct, instead of the actual struct

Working as intended

Description

If a ForEachLoop node is used to cycle through an Array of Structures, using the Array Element output of the Loop node to set the members of the structure does not save the changed values.

Workaround:
Create a variable from the Array Element of the loop and use the new variable to access the "Set Members..." node

Steps to Reproduce

1. Open UE4 Editor (any project)
2. Create a new Structure (NewStruct) and give it a number of MemberVars.
3. Create new blueprint based on actor
4. In the blueprint, create a variable of type NewStruct
5. Set the variable to an array
6. Drag a the variable array into the graph as a getter
7. Create a ForEachLoop node and wire the getter into the Array input
8. From the Array Element output create a "Set Members in NewStruct" node and a "Break NewStruct" node
9. Change the values in the Set node
10. Wire the Loop Body execution pin into the the Set Members node.
11. Wire the Set Members node into a Print String node
12. Wire one of the output pins from the Break node into the Print String node

Result:
Print string will print out the default value of the struct

Expect:
Values changed in the Set Members node are saved

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

By Design
ComponentUE - Gameplay - Blueprint
Affects Versions4.6.14.8
Target Fix4.7
CreatedFeb 2, 2015
ResolvedFeb 2, 2015
UpdatedApr 27, 2018
View Jira Issue