This is a very quick article about using re-route declaration nodes in Unreal Engine when creating materials that I think will help some folks avoid spaghetti when creating their materials!
First off, what is a named re-route declaration node? Well, starting with Unreal Engine 4.27 and continuing in Unreal Engine 5, the named re-route node basically allows you to store material logic in a single node and reuse it as an input in your result node. For you blueprint scripters out there, it’s basically like promoting a property to a variable so that you can use it later.
Here’s how it works!
To create a named re-route node, you just need to drag off of the pin that you wish to create one from, and type in “named reroute”.
In this case, I’m using a Material Function that creates an SDF (soft distance field) Box, and I want to store the SDF in a re-route node and use it somewhere else in my code.
All I have to do is drag off of the output, start typing “named reroute” and there will be a suggestion from the Utility dropdown for adding a “named reroute declaration node”.