No value will be returned by reference?

Problem is occurring in 4.21.2

No value will be returned by reference. Parameter ‘Measurements’. Node: Bind Event to Measurement
The variable is not set to pass by reference.

This is an issue again in 4.2 however, it only seems to occour when 2 or more arrays of the same class type are used (for example, 2 arrays of actor) The first Array will work as intended.

I ran into this issue when trying to call an RPC in my Gamestate BP. I put the rpc in my playercontroller instead and it worked. I’m guessing it was something to do with ownership.

I solve it!

That link claims the issue is fixed, yet it’s still happening in 4.22.3

if I change that to a single variable the error goes away

Had this happen for me today. Fixed it by checking the “Pass by Reference” checkbox and recompiling, then unchecking and recompiling again.

6 Likes

I’m not sure if the OP was doing this in Blueprints or C++, but I ran in to this issue creating a custom event in C++, so I thought I’d post the solution here in case it helps.

I was trying to create a custom event that would pass an array of the currently selected actors whenever the selection changes. This was the signature in my original attempt:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSelectionChanged, TArray<AActor*> , SelectedObjects);

This caused the “NOTE” message which said “No Value will be returned by reference.”.

I solved it by looking for places in the Engine Source that used this same pattern with Arrays as the parameter type and found several examples. The solution was to use this signature:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSelectionChanged, const TArray<AActor*> &, SelectedObjects);

Notice it changes:

TArray<AActor*>

To

const TArray<AActor*> &

i.e. A const reference. After doing this (and deleting my plugin binaries and intermediate folders), the NOTE message was no longer present.

I hope this helps someone.

11 Likes

Thanks a lot! :slight_smile:

I have this message on an event dispatcher, kinda makes sense that the data will be sent but unreal will not keep track of where it goes and how it will change to get it back.

Thing is that if i send a single variable I can disable pass by reference. But I can’t disable that check box for an array.

Anyone knows if I need to worry about something or is normal behavior?

image

Having this issue and using blueprints, just created structure that contains an array of type that you want, and then used that structure as input(single, not array) disables warning.
I’m using ue 5.0.3, if you don’t see break array node than restart editor.

This issue is still occurring for me on 5.0.3. But the suggested workaround, to put the arrays in a structure, worked great. you.

This is sad as hell if it is an unresolved issue because here, we are 7 years later and It’s still happening in UE 5.0.3 I’m having the same issue when trying to setup a Blueprint Interface that takes an Array of Floats

2 Likes

I solved this issue by deleting the Variable and Compiling it and then Adding the same Variable back and compiling it again…seems somehow a link was broken somewhere that caused this message.

1 Like

Screenshot _01
Screenshot_02


Screenshot_04

Recent example of the Note being there but I’m still getting the data I need.

I’ve had this Issue a few times in 5.0.3 as well. I have tried a few methods with varying success. Most of my problems with this note come from nodes that are passing an array. Here’s the things I try, and sometimes one of them works.

  1. On the Node Input, change the variable type from array to single, compile, and change it back to array again.
  2. Doing what-C0nn0r said and deleting the var (if not used all over the place) and remaking it.
  3. Using the right click find/replace tool and replacing the var with an identical one just renamed.
  4. And recently, I had this error/note on an Event Dispatcher where I wanted to pass an array of custom structs. The Note still says ,“No value…”, but low and behold I put a print string on the binding function where I am receiving the Dispatcher call, and it’s actually working even though the note persists.

It’s a shame this is still a bug, but if any devs are tracking this, the only thing I can see that is consistent across the board is that the problem arises when we are trying to pass an array. In my case, and it looks like a few others, most often an array of custom stucts. Maybe the ‘pass by ref’ option (which is grayed out and un-selectable with arrays) is the problem.

2 Likes

thanks that fix my issue, seem to happen in 5.1 as well.

For anyone who stumbles upon this.
An easy fix is to manually make the parameter for the event rather than dragging it from whatever node you’re using it. it’s annoying but hey, it works.
also note that if you have things connected to the broken input pin, you need to disconnect them before renaming the new pin’s name

2 Likes

what plugin are you you using for your blueprints. i rmemeber seeing and wanted to get it, but couldent remember what it was called

I am having this issue with Unreal 5.1.0 as well, but #1 worked for me. Simply changing the variable from array to single, compiling, then changing it back to an array and compiling works.

What TheNomadNamedY said is true as well, this appears to only happen when we don’t make the parameter manually and instead drag the value in from a node.

1 Like

I think it’s this one (Sorry for necro). Also this problem still exists in 5.2.1.