# Pass-By-Reference output

**URL:** <https://forums.unrealengine.com/t/pass-by-reference-output/439702>\
**Category:** Blueprint\
**Tags:** Struct, unreal-engine, function, Blueprint, question\
**Created:** [December 18, 2018, 8:33am UTC](https://forums.unrealengine.com/t/pass-by-reference-output/439702 "2018-12-18T08:33:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cucharon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cucharon](https://forums.unrealengine.com/u/Cucharon)\
**Post date:** [December 18, 2018, 8:33am UTC](https://forums.unrealengine.com/t/pass-by-reference-output/439702/1 "2018-12-18T08:33:57Z")

</div>

In a blueprint function, there is any way to return a reference to a struct/array of structs? You can do it in the input, why not in the output?

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [December 18, 2018, 3:28pm UTC](https://forums.unrealengine.com/t/pass-by-reference-output/439702/2 "2018-12-18T15:28:10Z")

</div>

No, the Blueprint VM doesn’t support returning types by-reference.

You can have a non-const reference parameter that will appear as an output pin on the BP node, but you’re still getting back a copy.

```
void MyFunc(const FThing& Input, FOther& Output);

```

Structs are basically treated as value types. If you want to be able to pass large amounts of data around without copying it then you’ll have to put it inside an object (which you’ll be able to pass/return by-pointer).

FWIW references don’t matter much to BP functions, as internally they always copy inputs in by value, and copy outputs back by value.

---

<div class="post-metadata">

**Author:** ![Orion\_78](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orion\_78](https://forums.unrealengine.com/u/Orion_78)\
**Post date:** [December 17, 2020, 3:48pm UTC](https://forums.unrealengine.com/t/pass-by-reference-output/439702/3 "2020-12-17T15:48:36Z")

</div>

The only “way” in blueprint is to use Macro.

---

<div class="post-metadata">

**Author:** ![eobet](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eobet/32/465239_2.png) [@eobet](https://forums.unrealengine.com/u/eobet)\
**Post date:** [August 14, 2023, 9:10am UTC](https://forums.unrealengine.com/t/pass-by-reference-output/439702/4 "2023-08-14T09:10:19Z")

</div>

Unless I’m mistaken, a macro can’t output a reference either…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/6/586a5263730c0f45b6e1e140c10942754239eaab.png)

---

<div class="post-metadata">

**Author:** ![killkiss\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@killkiss\_1](https://forums.unrealengine.com/u/killkiss_1)\
**Post date:** [December 24, 2023, 3:35pm UTC](https://forums.unrealengine.com/t/pass-by-reference-output/439702/5 "2023-12-24T15:35:37Z")

</div>

Just try with a macro. It works.
