# Updating array's that have been passed by reference

**URL:** <https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884>\
**Category:** Editor Scripting\
**Tags:** arrays, unreal-engine, Blueprint, question\
**Created:** [December 17, 2014, 7:12pm UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884 "2014-12-17T19:12:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asher\_S\_Einhorn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Asher\_S\_Einhorn](https://forums.unrealengine.com/u/Asher_S_Einhorn)\
**Post date:** [December 17, 2014, 7:12pm UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884/1 "2014-12-17T19:12:11Z")

</div>

If I pass an array by reference via an interface and then later modify the array in it’s original place, shouldn’t the array that I passed also update?

I am finding that this is not the case.

---

<div class="post-metadata">

**Author:** ![Erasio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Erasio](https://forums.unrealengine.com/u/Erasio)\
**Post date:** [December 17, 2014, 9:57pm UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884/2 "2014-12-17T21:57:00Z")

</div>

No it should not.

I’m not sure if you’re fluent in c or c++. Basically what your passing is a normal variable. It’s merely a copy of the variable you passed. What you want is a pointer. However there is (as far as I know) no direct way of doing that in blueprint.

You will have to provide the actor reference to get this behavior. If you have the whole actor and set / get the array directly from it you are modifying the original array.

I hope this helps.

Cheers

---

<div class="post-metadata">

**Author:** ![Asher\_S\_Einhorn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Asher\_S\_Einhorn](https://forums.unrealengine.com/u/Asher_S_Einhorn)\
**Post date:** [December 18, 2014, 2:50pm UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884/3 "2014-12-18T14:50:20Z")

</div>

Yeah I’m fluent in both - but in C# you CAN pass a list to another class and then modify that collection in either place and they’ll ‘both’ update - because it’s just one thing that you’re referencing.

If this is still passing by value, what does the checkbox for ‘pass as reference’ do?

---

<div class="post-metadata">

**Author:** ![Asher\_S\_Einhorn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Asher\_S\_Einhorn](https://forums.unrealengine.com/u/Asher_S_Einhorn)\
**Post date:** [December 18, 2014, 2:50pm UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884/4 "2014-12-18T14:50:34Z")

</div>

ah, yes, not fluent in ‘c’.

---

<div class="post-metadata">

**Author:** ![Baki\_Tamas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Baki\_Tamas](https://forums.unrealengine.com/u/Baki_Tamas)\
**Post date:** [December 18, 2014, 5:04pm UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884/5 "2014-12-18T17:04:17Z")

</div>

In C#, just like in Java, you pass objects by reference not by value (like in c/c++), you have to use pointer to achieve this effect.

---

<div class="post-metadata">

**Author:** ![Asher\_S\_Einhorn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Asher\_S\_Einhorn](https://forums.unrealengine.com/u/Asher_S_Einhorn)\
**Post date:** [December 26, 2014, 12:09pm UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884/6 "2014-12-26T12:09:37Z")

</div>

Yes but again, why then does it have a parameter that’s called ‘pass by reference’? what does that do? I would assume it passes something by reference but it does not.

Additionally, how can I pass a pointer to an array in blueprints?

---

<div class="post-metadata">

**Author:** ![PeterLNewton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PeterLNewton](https://forums.unrealengine.com/u/PeterLNewton)\
**Post date:** [December 27, 2014, 7:28am UTC](https://forums.unrealengine.com/t/updating-arrays-that-have-been-passed-by-reference/301884/7 "2014-12-27T07:28:02Z")

</div>

Are you sure **Erasio**? I use the pass-by-reference to replicate increment++ constructors found in programming. As shown below.  
25012-
