Placing multiple references to a local variable

So I have a function with a couple of local variables in, but I can’t see a way to place multiple references to those variables. For example, I set the variable at the start, update it in a loop, then return it at the end. It seems I have to drag a wire from the same block to all these areas, which makes the blueprint a mess of wires and you can’t see clearly what’s plugged in to where. It would be really handy if you could drop in multiple references to the variable to keep the graph clean, the way you can with non-local variables. Is that possible at all atm?

I would also like to know why you can’t simply Get and Set local variables in the way you can a regular variable. Why, instead, do you have to Assign a value to the variable rather than Set?

You can copy a variable multiple times in blueprint. Just use copy and paste. That works as much for local variables as normal variables. If it’s put in blueprint event graph, it can be copied. As for assigning values, that’s likely a code separation deal. They’re different types of variables. So they get treated differently.

If I copy and paste a local variable node, it creates a new local variable, not a second reference to the same variable. So I’m still stuck with having all the uses of my local variable having to be from the same node.

Running into this problem myself. I can create the local variables and assign them, but cannot reference them at all.

This need to be a feature request to Epic and hopefully they can chime in. Blueprint functions are kinda pointless when trying to use anything scoped locally to just that function. I was rocking along until I hit this wall, bummer really. The only solution is to create a variable at the blueprint level, maybe prefix them with the letter f. At least that way you can get/set like you normally would…but what a nasty hack having your variables scoped that way. I would expect to be able to get/set local vars just like any other and have them scoped to just that function (like the local var help text says it is).

You have to drag off the pin from the original “local variable” node.

I second this. I want to be able to treat local variables just like member variables but with the exception that they are local. The editor should handle that under the hood for me.

I would also like the ability to init the variable to a default value every time I enter the function. This doesn’t need to be a “set” operation in the graph, it can be in the properties. I declare it’s type in the properties so I should be able to declare it’s starting value.