How do I return a struct by reference in a blueprint function

I have a helper function that I’m using to look up a struct in an array and return it. In that function, I’m using the Get (a ref) version of the getter and then using that value as my output. When I do this, it does a copy.

How do I configure my blueprint function to return by ref?

Unfortunately that simply isn’t possible in base blueprints (I say base cause it might be possible with K2Nodes, but that’s a rabbit hole you’d best avoid).

Even if you use the jank strategy you can use for passing delegates, while it will result in the output appearing to be a ref,
image
It won’t actually be a ref
image

If you absolutely need a reference through a get function, you’ll need to use objects instead.

1 Like

Bummer. Thanks.

1 Like

If you understand references to that degree, making a custom blueprint function in c++ is among the easier things to do in Unreal C++.