Operating on a copy of the struct, instead of the actual struct
Working as intended
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
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
Why does the REMOVE method of map container remove elements have memory leaks?
UMG RichText not appear image when packaged
How does TextureRenderTarget2D get TArray<uint8> type data?
How to delete some elements correctly when deleting an array loop?
How do I set a material as a post-processing material?
What is the difference between Camera and CineCamera?
How does TArray loop correctly remove elements in blueprints?
What is the cause of the packaging error falling back to 'GameUserSettings' in ue5?
How to implement springarm components to scale according to mouse position in spawn?
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.6.1, 4.8 |
Target Fix | 4.7 |
Created | Feb 2, 2015 |
---|---|
Resolved | Feb 2, 2015 |
Updated | Apr 27, 2018 |