Pass-By-Reference local variable

Hi,

I’ve noticed that when I use the pass by reference checkbox on a variable within a function, I cannot set a local variable in that function, that will correspond (point to the same value) to the input variable (the one that was sent as a reference).
This is how I have to work for now. It’s very cumbersome.

And this is what I suggest - there should be a way to define a local variable as a reference, so it should have an input by reference, where I can plug the value passed by reference from the function. Here is an image of what it should look like:

Thanks

4.16 introduced Parameters as “Local” Variables.

In the Context Menu search for “Variable” and then the Parametername

Very nice! :slight_smile:
Thank you. Is there any other way to get this variable? The current method is a bit hidden.

Nope, I already made a request for that.

Nope, I already made a request for that.
[/QUOTE]

Great! Can you send me the link to your thread, so I can back you up.

Anyone knows if this is possible with version 4.25.1? I’ve been trying to find a way to do exactly what is being proposed in the first message of this thread for the same reasons: to store a pass by ref variable in a local variable so you can use that down the graph without having to drag long connections from the input nodes of the function. No luck so far, it seems that when you set a local variable with a pass by ref variable value, it just copies the variable value to the local variable instead of keeping the reference to the original variable…

I am also encountering the problem as described by OP. I cannot find Parameters in 4.25.3

Did they move that functionality to some obscure hiding place or am I blind?

In the function graph just right click and type “get yourinputname” and it’ll get a reference to the input. No need to make any additional local variables.

This was very helpful, expect (UE5.3) I am having issues setting members of struct fo pass-by-reference function input, howver do not get compile errors for structs within struct.


In the screenshot above, the Char Sheet Variable is a Pass-by-Ref Function Input. I get compile errors when I try to right click and choose the function input variable, but when setting members of a struct within that struct I do not get errors.

If I connect directly to the function Input, it compiles. I replaced all my connections and solved the issue I was having where Varaibles were notbeing passed and set correctly.
It took me DAYS to figure this out, as the EXPECTED BEHAVIOR to mewas naturally if passed by reference and setting a local variable, the local variable would also be set as a reference. Then after discovering the right click and selecting the function input variable, it still did not work until I connected directly to the function input.

Right Clicking and choosing the Function Input is READ_ONLY, and should be SETTABLE, unless as a novice programmer, i am missing some standard programming features as to why it would and SHOULD? be read-only.