Access function parameter without creating new local variable?

Is there a way to access a function parameter quickly inside the function instead of dragging a wire all the way from function entry node?

Right now I’m assigning the parameters to local variables but whilst doing so I also noticed that the name of my local variable cannot be the same as the name of the parameter (you get an error ‘conflicts another function parameter’).

This makes me wonder whether there is some way to access function parameters directly as variables that I’ m missing. The first half of my functions are usually cluttered with SET localVar1 to param1, SET localVar2 to param2, etc and that feels redundant.

Gentle bump :slight_smile: let me know if the question is unclear!

Unfortunately I am unaware of a way to do this aside from local variables or running wires as you mentioned.

Only thing I can recommend is to use “Reroute nodes” on a wire pulled out of a parameter, it helps to control the way the wires are routed and can make it easier to read. Assigning them to variables is not the best way to go simply because you are creating more complexity, it has read the input parameter, set the variable, and then look it up later when it is used, instead of just reading the parameter directly. It could cause performance issues if you were using this a lot, but mostly it is using up more memory to store an additional variable.

If the function is getting difficult to read because of a mess of wires, it is probably best to split up the function into smaller functions. Sometimes it isn’t possible, but re-route nodes can be your friend! This is an example where I should be using more re-routes :stuck_out_tongue:

Woah I didn’t even know such a thing existed! :open_mouth: This will certainly come in handy in many blueprints of mine, can’t believe I’ve never seen this node before!

Your other suggestions also make sense, it is true that I should be refactoring my functions better in the first place. That said as I’m still learning the engine I’m wary of overzealous refactoring as it takes a while to fully commit to a solution or approach for a particular piece of functionality.

It’s been a few years since this post but nevertheless the answer can be useful for someone. You can find the Get Node of a parameter, by typing its name in the search line in the right-click context menu, just like any other node. To set the value of a parameter you can use the Set-by-ref Node, which can be found in the right-click context menu accessed while drugging off the data pin of the Get Node.