# Set Members in Struct: SOLUTION!

**URL:** <https://forums.unrealengine.com/t/set-members-in-struct-solution/302145>\
**Category:** Blueprint\
**Tags:** Struct, unreal-engine, bug-report, Blueprint, question\
**Created:** [December 21, 2014, 1:10am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145 "2014-12-21T01:10:51Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [December 21, 2014, 1:10am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/1 "2014-12-21T01:10:51Z")

</div>

I’ve been running into problems where using set members in struct function would overwrite any empty pins with default values. After about 2 weeks of beating my head against desk, I worked it out a few minutes ago.

Solution: When editing custom structs in BP using Set Member in Struct function, select node, and under node properties hide any pins that you are not updating. This will make it so that it does not update anything but what you actually have connected.

Testing:

Create a struct with default values.  
Pass struct to a function  
Inside function do something to edit variables and then try to assign something to each of them them with “Set Members in Struct” without hiding any pins.  
Next, make some more edits, and then try to assign values using Set Members in Struct. Leave some pins empty but not hidden.  
Print Struct.

Next, alter second struct by hiding unused pins.  
Print struct.

This method works on structs of structs, and structs of structs of structs.

To be tested:

I have not yet tested if this will work with structs within an array. it would be worth testing though.

Cheers!

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [December 21, 2014, 8:24am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/2 "2014-12-21T08:24:20Z")

</div>

No Answer Needed. Answer in OP.

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [December 23, 2014, 7:22am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/3 "2014-12-23T07:22:45Z")

</div>

This has been tested in 4.6.0 and confirmed to work with Arrays of structs. Just remember to set your array element after setting members of your struct.

---

<div class="post-metadata">

**Author:** ![Onoa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Onoa](https://forums.unrealengine.com/u/Onoa)\
**Post date:** [February 6, 2015, 3:06am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/4 "2015-02-06T03:06:06Z")

</div>

Hi,

Not having any luck using this trick with Arrays of structs. values do not udate (even if I remove unused pins).

What do you mean exactly by “Just remember to set your array element after setting members of your struct.” ?

I’m using 4.6.1

Thanks,

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [February 6, 2015, 6:21pm UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/5 "2015-02-06T18:21:45Z")

</div>

If you make a change to struct itself, reset element in array with struct. i.e. edit struct then do an array set element and pass it newly edited struct.

if you will post up a picture of your current setup I will have a look and help if I can.

---

<div class="post-metadata">

**Author:** ![Pixeldead\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pixeldead\_1](https://forums.unrealengine.com/u/Pixeldead_1)\
**Post date:** [February 20, 2015, 6:32pm UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/6 "2015-02-20T18:32:47Z")

</div>

Hey RAV,

Would you mind posting up an image of your solution of this working with an array of structs ?

Thanks buddy !

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_01dd28a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_01dd28a6](https://forums.unrealengine.com/u/anonymous_user_01dd28a6)\
**Post date:** [March 4, 2015, 5:04am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/7 "2015-03-04T05:04:26Z")

</div>

Beter solution here. We have a backpack with an array of InventoryItem structs,  
I pass in struct by reference, then break it, then set all fields, then set to a local struct (forcing a copy)  
then return by value. You then put this back into array.

 ![32129-structsetfieldsblueprint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/7/4/574a308ec9d1582a988f1716953d7bf1d1755f4f.png)

Here is upper level call to function.

 ![32130-setstructfieldblueprintcall.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/0/e/30e6a59835216a4a43e8363119a4d80ea19b6a80.png)

---

<div class="post-metadata">

**Author:** ![walldiv](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@walldiv](https://forums.unrealengine.com/u/walldiv)\
**Post date:** [March 22, 2015, 4:32pm UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/8 "2015-03-22T16:32:42Z")

</div>

QUESTION:

I’m doing an inventory system with dropping items out of inventory, spawning that actor in world but need to pass struct details from dropped item to spawned item in world. . . . problem being is construction script of spawned item is setting default values for class object.

Screen picture is below of how i’m trying to implement this… i have CONFIRMED through several rounds of PRINT STRINGS that variables are INDEED getting passed through custom event bind (coming from my HUD ON DROP action, calling event dispatcher in my controller script) so variable passing is not an issue… it is SETTING these variables upon spawn of actor class. Any solutions out there for this? This post and one other are only relevant posts i see regarding this information.

 ![35350-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/6/7a682b207a8930879a4805131186121ba11ac5ab.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [March 23, 2015, 10:03pm UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/9 "2015-03-23T22:03:24Z")

</div>

Hi walldiv,

Your best bet for getting this in front of more people is to open a new question in Blueprint Scripting section:

[https://answers.unrealengine.com/spaces/22/blueprint-scripting.html](https://answers.unrealengine.com/spaces/22/blueprint-scripting.html)

Feel free to reference this post with a link if you think it’s relevant. Thanks!

---

<div class="post-metadata">

**Author:** ![RAVaught](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RAVaught](https://forums.unrealengine.com/u/RAVaught)\
**Post date:** [March 27, 2015, 4:04am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/10 "2015-03-27T04:04:46Z")

</div>

This is also why I was mentioning delegate binding in construction scripts in one of my other posts. We ran into a similar problem and I am not yet certain how to work around it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_01dd28a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_01dd28a6](https://forums.unrealengine.com/u/anonymous_user_01dd28a6)\
**Post date:** [March 27, 2015, 4:09pm UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/11 "2015-03-27T16:09:42Z")

</div>

We finally punted on this issue and converted struct to a class.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6268ec901](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6268ec901](https://forums.unrealengine.com/u/anonymous_user_6268ec901)\
**Post date:** [January 5, 2016, 11:13pm UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/12 "2016-01-05T23:13:42Z")

</div>

Heh, how can i convert struct to a class and create some objects using that class? I can’t see any possibility to do this using blueprints, i afraid i have to start my project using raw c++ code to achieve any good result.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_01dd28a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_01dd28a6](https://forums.unrealengine.com/u/anonymous_user_01dd28a6)\
**Post date:** [January 6, 2016, 4:17am UTC](https://forums.unrealengine.com/t/set-members-in-struct-solution/302145/13 "2016-01-06T04:17:54Z")

</div>

I have never needed to convert a struct to a class. Just create a class from start.
