# 4.14.1 Array within structure Array result in nothing

**URL:** <https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [December 24, 2016, 11:17am UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120 "2016-12-24T11:17:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ipas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ipas](https://forums.unrealengine.com/u/ipas)\
**Post date:** [December 24, 2016, 11:17am UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/1 "2016-12-24T11:17:05Z")

</div>

![119823-array_struc_array.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/4/b/54bc80c80e202c9a905e51d3e8d6460be795e702.jpeg)

I have this problem:

I have an array of a structure .  
Within the structure I have a couple of arrays.  
I’m trying to add an element to the array

The adding leads to nothing. This should be possible right ? Is this a bug ?

---

<div class="post-metadata">

**Author:** ![Daniel\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Daniel\_K](https://forums.unrealengine.com/u/Daniel_K)\
**Post date:** [December 24, 2016, 4:01pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/2 "2016-12-24T16:01:08Z")

</div>

Just run into exactly same issue. It’s totally strange behavior since Add isn’t even returning a new array so it’s should be mutating original one. I tried various approaches like Set Array Item, Append an array with that new item or Insert. Nothing is able to touch that inner array. Perhaps it’s some weird limitation of a struct?

---

<div class="post-metadata">

**Author:** ![ipas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ipas](https://forums.unrealengine.com/u/ipas)\
**Post date:** [December 24, 2016, 4:14pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/3 "2016-12-24T16:14:53Z")

</div>

My workaround for now is that I add the element to a local array and set the array completely with the local array as input.

---

<div class="post-metadata">

**Author:** ![Titirez](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/titirez/32/1194668_2.png) [@Titirez](https://forums.unrealengine.com/u/Titirez)\
**Post date:** [December 24, 2016, 4:24pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/4 "2016-12-24T16:24:05Z")

</div>

That is not a bug. Structures get passed by value, not reference. When you use the “Get element at index 0” node on a array of structures, it returns a copy. After you do whatever changes you want to do, use the “Set array element node” to set the new structure at index.

---

<div class="post-metadata">

**Author:** ![ipas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ipas](https://forums.unrealengine.com/u/ipas)\
**Post date:** [December 24, 2016, 4:28pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/5 "2016-12-24T16:28:13Z")

</div>

Ah thanks… so my current ‘workaround’ actually is the way to do it.Got it.

---

<div class="post-metadata">

**Author:** ![Daniel\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Daniel\_K](https://forums.unrealengine.com/u/Daniel_K)\
**Post date:** [December 24, 2016, 5:29pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/6 "2016-12-24T17:29:08Z")

</div>

Yes thanks, I confirm it indeed works like that, but it’s totally awkward 🙂 Would be very useful if there was option to get reference of struct from array.

---

<div class="post-metadata">

**Author:** ![Daniel\_K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Daniel\_K](https://forums.unrealengine.com/u/Daniel_K)\
**Post date:** [December 24, 2016, 5:29pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/7 "2016-12-24T17:29:42Z")

</div>

Btw, @ipas, be that kind and mark this as answer 😉

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_40a407b6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_40a407b6](https://forums.unrealengine.com/u/anonymous_user_40a407b6)\
**Post date:** [January 8, 2017, 7:00pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/8 "2017-01-08T19:00:19Z")

</div>

I tried this as well. I still cannot get it to work. Could someone possibly post a screenshot of how they set up the working code?

---

<div class="post-metadata">

**Author:** ![ipas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ipas](https://forums.unrealengine.com/u/ipas)\
**Post date:** [January 8, 2017, 7:27pm UTC](https://forums.unrealengine.com/t/4-14-1-array-within-structure-array-result-in-nothing/380120/9 "2017-01-08T19:27:04Z")

</div>

![121314-array_within_strucure_sample.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/6/ff692f1060d9be20466e78de89ab3dc215d5fbc4.jpeg)

Here is a sample on how to get this working. First the content of the strucure-array into local arrays. Second manipulate the arrays by adding or removing items. Third set the element of the array-structure. This is in fact replacing the element with all the arrays.

Hope this helps.
