# Blueprint "Array Get by Reference", and edit struct elements directly

**URL:** <https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841>\
**Category:** Feedback & Requests\
**Tags:** unreal-engine\
**Created:** [December 26, 2014, 11:34pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841 "2014-12-26T23:34:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhi\_Kang\_Shao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zhi\_Kang\_Shao](https://forums.unrealengine.com/u/Zhi_Kang_Shao)\
**Post date:** [December 26, 2014, 11:34pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/1 "2014-12-26T23:34:34Z")

</div>

I believe that currently when retrieving an item from an array using the Array Get node, it is always a copy of the data inside the array. In some cases, such as when working with structs that contain arrays, it would be better if there was an option to get a reference to the struct inside the array so you can directly alter it. Specifically when the struct contains an array, it would be great if we could directly alter that array without having to make a copy of the struct and reinserting that into the outer array. Here is how it currently would be done:

 ![array.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/5/f/5fb6fc494d599dd74147440b4df0224a08983b34.png)

And this is what it could look like if there was an Array Get By Reference option:

 ![array2.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/c/9cc973c19fc30b7267bd1fddf126800bfcb3cf71.png)

It would be even greater if specific struct members could be altered without having to respecify all others.

---

<div class="post-metadata">

**Author:** ![Semitable](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Semitable](https://forums.unrealengine.com/u/Semitable)\
**Post date:** [February 9, 2015, 1:04am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/2 "2015-02-09T01:04:15Z")

</div>

I actually stumbled upon this ‘issue’ too! Had to work around my initial project ‘structure’ that used arrays of structs! ☹  
Could be great though since structs always were a _great_ way to organize stuff! (at least for me!)

---

<div class="post-metadata">

**Author:** ![timi707](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/timi707/32/1194713_2.png) [@timi707](https://forums.unrealengine.com/u/timi707)\
**Post date:** [February 9, 2015, 1:23am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/3 "2015-02-09T01:23:53Z")

</div>

I assumed it worked the way you are requesting, I hope they make this possible, would make handling item stacking much, much easier.

---

<div class="post-metadata">

**Author:** ![Semitable](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Semitable](https://forums.unrealengine.com/u/Semitable)\
**Post date:** [February 9, 2015, 2:22am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/4 "2015-02-09T02:22:42Z")

</div>

There are a _few_ places that struct referencing works fine! But specifically in arrays (and maybe a few other places) you just get copies of the struct which makes it both inefficient and hard to work with!  
Hopes it gets fixed! Thank you! 😃

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f28231101](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f28231101](https://forums.unrealengine.com/u/anonymous_user_f28231101)\
**Post date:** [February 9, 2015, 7:21am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/5 "2015-02-09T07:21:49Z")

</div>

That would be a great feature. I have a struct to fake 2 dimensional arrays and the blueprint code to manipulate the ‘inner’ array is quite ugly and can be hard to debug. I would appreciate a simple solution.

---

<div class="post-metadata">

**Author:** ![RVillani](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rvillani/32/1194572_2.png) [@RVillani](https://forums.unrealengine.com/u/RVillani)\
**Post date:** [July 12, 2015, 10:36pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/6 "2015-07-12T22:36:23Z")

</div>

Bump. I need it too. Everyone needs it. hahaha  
It makes a really cumbersome Blueprint when we need to edit struct arrays.  
I tried changing my struct to a class, but instead of extending Actor (I don’t need all the Ticking etc), I did it with Object, to keep it lightweight. It just didn’t cut it because we can’t instantiate new Objects inside Blueprints. That’s a bummer. So, for now, I’m making the cumbersome code of editing structs inside arrays.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a08c0bf2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a08c0bf2](https://forums.unrealengine.com/u/anonymous_user_a08c0bf2)\
**Post date:** [July 14, 2015, 7:57pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/7 "2015-07-14T19:57:33Z")

</div>

Hey Everyone,

Thanks for making the array request. I have logged this as UE-18616 to be taken into further consideration by our developers. Let us know if you have any further questions, have a great day!

-

---

<div class="post-metadata">

**Author:** ![Devero](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Devero](https://forums.unrealengine.com/u/Devero)\
**Post date:** [September 17, 2015, 3:34pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/8 "2015-09-17T15:34:26Z")

</div>

+1 for this =) Its cumbersome to do in Blueprints

---

<div class="post-metadata">

**Author:** ![CriErr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CriErr](https://forums.unrealengine.com/u/CriErr)\
**Post date:** [September 17, 2015, 3:55pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/9 "2015-09-17T15:55:43Z")

</div>

Yes please, we need return updated array from “add” and “add unique” nodes.

---

<div class="post-metadata">

**Author:** ![Spoondog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spoondog](https://forums.unrealengine.com/u/Spoondog)\
**Post date:** [September 18, 2015, 2:02am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/10 "2015-09-18T02:02:31Z")

</div>

Yes please!

---

<div class="post-metadata">

**Author:** ![Mattlauk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mattlauk](https://forums.unrealengine.com/u/Mattlauk)\
**Post date:** [October 16, 2015, 6:26am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/11 "2015-10-16T06:26:37Z")

</div>

Are there any updates on this feature?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_cacd3de0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cacd3de0](https://forums.unrealengine.com/u/anonymous_user_cacd3de0)\
**Post date:** [December 15, 2015, 10:26am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/12 "2015-12-15T10:26:11Z")

</div>

This is crazy. How do you expect people to use this stuff? What’s the status?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089a4978](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089a4978](https://forums.unrealengine.com/u/anonymous_user_089a4978)\
**Post date:** [March 17, 2016, 3:47pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/13 "2016-03-17T15:47:01Z")

</div>

Why you didn’t developed this node in the first release? This is a very simple and common function in every programming languages.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_48f2118e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_48f2118e](https://forums.unrealengine.com/u/anonymous_user_48f2118e)\
**Post date:** [August 2, 2016, 5:26am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/14 "2016-08-02T05:26:53Z")

</div>

> [@anonymous\_user\_a96278c3a ;332311](#):
>
> Hey Everyone,
> 
> Thanks for making the array request. I have logged this as UE-18616 to be taken into further consideration by our developers. Let us know if you have any further questions, have a great day!
> 
> -

can you please make UE-18616 public?

---

<div class="post-metadata">

**Author:** ![Raildex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Raildex](https://forums.unrealengine.com/u/Raildex)\
**Post date:** [August 2, 2016, 7:20am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/15 "2016-08-02T07:20:24Z")

</div>

Still there’s no sign that someone is working on this.

> **[Blueprint "Set Members in Struct" should work with Arrays](https://forums.unrealengine.com/showthread.php?118417-Blueprint-quot-Set-Members-in-Struct-quot-should-work-with-Arrays)**
>
> Hi. “Set Members in Struct” still doesn’t work with Arrays. Many users complained that you have to use “set Array elem”. In my Example I have one big Main Array of “S\_Item Stack” as seen above. Every Item has a category. What If I want to have...

---

<div class="post-metadata">

**Author:** ![zeOrb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zeOrb](https://forums.unrealengine.com/u/zeOrb)\
**Post date:** [August 2, 2016, 12:09pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/16 "2016-08-02T12:09:24Z")

</div>

> [@Raildex\_;574442](#):
>
> Still there’s no sign that someone is working on this.
> 
> [Blueprint "Set Members in Struct" should work with Arrays - Feedback & Requests - Epic Developer Community Forums](https://forums.unrealengine.com/showthread.php?118417-Blueprint-quot-Set-Members-in-Struct-quot-should-work-with-Arrays)

Actually there is. I’ve mentioned an [issue ticket](https://issues.unrealengine.com/issue/UE-6451) in your thread and status was changed to “Not reproducible in 4.13”. So now the only thing we can do is to wait for 4.13 to test it

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a08c0bf2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a08c0bf2](https://forums.unrealengine.com/u/anonymous_user_a08c0bf2)\
**Post date:** [August 2, 2016, 1:25pm UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/17 "2016-08-02T13:25:14Z")

</div>

@ UE-18616 was not added to the Public site because it was a duplicate of other similar issues: [UE-20424,](https://issues.unrealengine.com/issue/UE-20424) [UE-6451](https://issues.unrealengine.com/issue/UE-6451) and [UE-24080](https://issues.unrealengine.com/issue/UE-24080)

Thanks!

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [September 29, 2016, 12:31am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/18 "2016-09-29T00:31:38Z")

</div>

> [@zeOrb;574539](#):
>
> Actually there is. I’ve mentioned an [issue ticket](https://issues.unrealengine.com/issue/UE-6451) in your thread and status was changed to “Not reproducible in 4.13”. So now the only thing we can do is to wait for 4.13 to test it

Well I just reproduced this issue in 4.13 so I hope it is still active

The various reports mentions above should help hopefully 🙂

Great job on starting this thread [MENTION=346351]Zhi Khang Shao[/MENTION]!

````auto

**C++ Solution**

An easy way to work around this if you have C++ powers and dont want to re-write a lot of code structure, is simply something like this:

I tried to think of a Victory Plugin generic solution for BP-only users, but I know well the complexity of arrays in Blueprints, under the hood. It may require engine modification :)

```

UFUNCTION(BlueprintCallable,Category="Your Class")
void SetBeatParam(int32 Index, FString Param, float Value);

void AYourClass::SetBeatParam(int32 Index, FString Param, float Value)
{ 
	if(!Metronome_Beats.IsValidIndex(Index)) 
	{
		VSCREENMSGF("Array access out of bounds!", Index);
		return;
	}
	 
	if(Param == "Enabled")
	{
		Metronome_Beats[Index].Enabled = (Value > 0) ? true : false;
		return;
	}
	if(Param == "Channel")
	{
		Metronome_Beats[Index].Channel = Value;
		return;
	}
	if(Param == "Pitch")
	{
		Metronome_Beats[Index].Pitch = Value;
		return;
	}
	 
	if(Param == "Velocity")
	{
		Metronome_Beats[Index].Velocity = Value;
		return;
	}
	 
	VSCREENMSG2("Unknown param!", Param);
}

```

It's subject to spelling errors but if you do some output like I do at the bottom you can catch spelling errors easy :)

:)
````

---

<div class="post-metadata">

**Author:** ![Dev.TMG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dev.TMG](https://forums.unrealengine.com/u/Dev.TMG)\
**Post date:** [April 13, 2017, 11:27am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/19 "2017-04-13T11:27:39Z")

</div>

> [@;601538](#):
>
> Well I just reproduced this issue in 4.13 so I hope it is still active

I found that Break struct seems to return a ref but Set node seems to return a copy, (in 4.15.1)  
So, if we use a local variable as a cache (Temp attackable targets in sample), it’s a copy.

By the way, tooltip of Get node seems wrong (if it returns a ref).  
It says “a copy”.  
And it lacks what will happen if index is not valid.  
(No error/log occurs but the values set to the struct member arrays seems to be ignored. This also be a possible bug.)

---

<div class="post-metadata">

**Author:** ![Dev.TMG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dev.TMG](https://forums.unrealengine.com/u/Dev.TMG)\
**Post date:** [April 13, 2017, 11:53am UTC](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841/20 "2017-04-13T11:53:10Z")

</div>

\> No error/log occurs but the values set to the struct member arrays seems to be ignored.  
Correction.  
No error/log occurs when values are set to the struct member / member arrays (as if a struct exists),  
but original array of structs which is connected to Get node input pin will not changed (as the struct Get node returned is not contained in the original array of structs).

Thanks.

[Next page](https://forums.unrealengine.com/t/blueprint-array-get-by-reference-and-edit-struct-elements-directly/17841.md?page=2)
