Blueprint Basics · Easy · 12 min

Blueprint Functions and Keeping Your Graphs Tidy

Tame a messy Blueprint: collapse repeated logic into a reusable function with inputs and outputs, box and label sections with comments, and straighten your wires with reroute nodes so future-you can actually read the graph.

LevelEasy Time~12 min EngineUE 5.4+ Hands-on18 checkpoints

Before this: What Is a Blueprint? Create Your First One (No Code Required), Event Graph Basics: BeginPlay, Nodes, and Wires Explained, Blueprint Variables: Store and Change Values to Drive Behaviour

By the end, you'll be able to
  • Collapse a chunk of repeated nodes into a clean, reusable function
  • Give a function inputs and outputs so you can call it with different values
  • Box and label sections of your graph with comments (press C)
  • Untangle long wires with reroute nodes and keep a graph readable

Why a tidy graph is a beginner superpower

By now you've wired up a few Blueprints, and you may have noticed something: graphs get messy fast. Wires cross each other, the same little group of nodes appears three times, and after a week away you open it up and have no idea what it does. That's normal — everyone's first graphs look like a plate of spaghetti.

This lesson is about the three habits that fix that, and they're genuinely easy. First, a 'function' lets you take a chunk of nodes you keep repeating and bottle it up under one tidy node you can reuse. Second, 'comments' let you draw a labelled box around a section so it's obvious what each part does. Third, 'reroute nodes' let you bend a long wire so it stops cutting across everything. None of this changes what your game does — it changes how easy your Blueprint is to read, fix and build on. Let's clean one up.

Four terms to lock in first

Tap a card to flip it

What makes something worth turning into a function

A function earns its keep when you find yourself building the same little group of nodes more than once, or when one section of your Event Graph has grown so big it's hard to follow. Classic examples: 'apply damage to the player', 'play a sound and a particle effect', 'check if the player has enough coins'.

The win is twofold. Reuse: build it once, call it from ten places. And tidiness: a wall of fifteen nodes shrinks to a single, clearly-named node like 'Apply Damage', so your main Event Graph reads like a sentence instead of a wiring diagram. A bonus you'll appreciate later — if you find a bug, you fix it in the one function instead of hunting down every copy.

Collapse messy logic into a reusable function

We'll take a few nodes that belong together and turn them into a clean function with an input and an output. Any Blueprint with a small chunk of logic in its Event Graph works — open one and follow along. Tick each step as you go.

  1. 1Select the nodes you want to bundle

    In the Event Graph, click an empty spot and drag a selection box (a 'marquee') around the group of nodes that belong together — for example the nodes that subtract some damage from a Health variable and clamp it so it never goes below zero.

    Selected nodes get a coloured outline. Pick a self-contained chunk: one clear job, with one thing flowing in and one result coming out.

    TipHold Ctrl and click to add or remove individual nodes from a selection if the box grabbed too many or too few.

  2. 2Collapse them into a function

    With the nodes selected, right-click any one of them and choose 'Collapse to Function'. Unreal scoops the selected nodes into a brand-new function and drops a single node in their place that represents the whole bundle.

    Over on the left in the My Blueprint panel, a new entry appears under 'Functions'. Double-click it to open the function's own graph and see the nodes that moved inside.

    TipRight next to it is 'Collapse to Macro' and 'Collapse Nodes'. Stick with 'Collapse to Function' for now — it's the most reusable and the easiest to reason about as a beginner.

  3. 3Give the function a clear name

    The new function usually gets a generic name. In the My Blueprint panel, click it once, then click again (or press F2) to rename it. Name it after what it does, like 'ApplyDamage' or 'TryBuyItem'.

    Good names are the cheapest documentation there is. A node labelled 'ApplyDamage' tells the whole story; a node labelled 'NewFunction_2' tells you nothing.

    TipName functions for the action they perform (a verb): ApplyDamage, ResetLevel, PlayPickupFx. Reserve nouns for variables.

  4. 4Add an input so you can call it with different values

    Open the function and click its entry node (the node at the start of the graph, labelled with the function's name). In the Details panel you'll see an 'Inputs' section — click the '+' to add one.

    Give the input a name like 'DamageAmount' and set its type (e.g. Float for a decimal number). A matching pin now appears on the function node out in the Event Graph, so each place that calls it can pass its own value.

    TipInside the function, drag off the new input pin to use that value instead of a hard-coded number — that's what makes the function flexible.

  5. 5Add an output to hand a result back

    Still on the function, find the 'Outputs' section in the Details panel and click '+'. Name it something like 'HealthRemaining' and set its type.

    Unreal adds a 'Return Node' inside the function graph with a matching pin. Wire your final result into that pin. Back in the Event Graph, the function's node now has an output pin you can plug into whatever comes next.

    TipA function can have several inputs and outputs. Keep it focused, though — if it needs ten of each, it's probably trying to do too many jobs and should be split.

  6. 6Reuse it and compile

    Back in the Event Graph, right-click and search for your function by name to drop another copy of its node wherever you need the same logic — that's the reuse payoff.

    Click 'Compile' (top-left of the Blueprint editor), then 'Save'. A green tick means your function is valid and ready to use.

    TipIf the function node shows an error after collapsing, open it and check that everything it needs is either an input or available on the Blueprint — collapsing can sometimes leave a wire dangling that you'll need to reconnect.

Box, label and straighten the rest of the graph

Now the documentation pass. These two habits — comment boxes and reroute nodes — take seconds and make the difference between a graph you dread opening and one you can read at a glance.

  1. 1Comment-box each section with C

    Marquee-select a group of related nodes and press C. Type a short label describing what that section does, then click away.

    Repeat for each logical chunk: setup, the main event logic, cleanup. Aim for a graph where someone could read just your comment titles and understand the flow.

    TipClick a comment box and change its colour in the Details panel — a quiet colour code (e.g. green for setup, amber for gameplay) makes big graphs scannable.

  2. 2Tame a long wire with a reroute node

    Find a wire that cuts awkwardly across the graph or behind other nodes. Double-click directly on the wire — Unreal drops a small reroute node (a pass-through dot) right on it.

    Drag that dot to bend the wire around the clutter. The signal is completely unchanged; you've just given the wire a corner so it stops crossing everything.

    TipAdd a couple of reroute nodes to route a wire neatly along the top or bottom edge of the graph, the way you'd run a cable around the skirting board instead of across the floor.

  3. 3Line things up so flow reads left to right

    Drag nodes so execution generally flows left to right and top to bottom — the order things happen should match the order you read.

    Select a few nodes, right-click, and use the options under the 'Alignment' submenu to snap them into tidy rows and columns.

    TipThe right-click 'Alignment' submenu lists each align/straighten option alongside its keyboard shortcut, so once you learn them you can line nodes up without pixel-nudging.

  4. 4Compile, save, and admire

    Press Compile, then Save. Comments and reroutes never affect behaviour, so this is purely a tidiness pass — but it pays off every single time you reopen the Blueprint.

    Step back and read your graph top to bottom. If the comment titles alone tell the story, you've nailed it.

    TipMake tidying part of finishing a feature, not a separate chore — a five-minute cleanup now saves you an hour of confusion next month.

Tidy-graph shortcuts worth memorising

  • C Wrap the selected nodes in a labelled comment box
  • Double-click wire Drop a reroute node on a wire to bend it neatly
  • F2 Rename the selected function or variable in the My Blueprint panel
  • Ctrl click Add or remove a single node from the current selection
  • Ctrl W Duplicate the selected node(s) in place
  • Compile Validate the Blueprint — the top-left button; look for the green tick

If comment boxes and reroute nodes don't change what the game does, are they a waste of time?

Two ways to shrink a big graph

Bundles nodes into a named, reusable function with its own graph, inputs and outputs. It appears in the My Blueprint panel under Functions and you can call it from anywhere with right-click → search by name.

Best when the logic is a self-contained job you'll reuse, or when you want a clearly-named single node in your Event Graph. This is your default as a beginner.

ChallengeTry it yourself

Take a Blueprint with some logic in its Event Graph (a pickup, a door, anything). Collapse one chunk into a function called 'ApplyDamage' with a Float input named 'DamageAmount' and a Float output named 'HealthRemaining'. Then comment-box every remaining section of the Event Graph with a clear label, and use at least one reroute node to straighten a long wire. Compile clean.

Hint 1

Marquee-select the chunk, right-click → Collapse to Function, then rename it in the My Blueprint panel.

Hint 2

Add the input and output on the function's entry/return nodes via the Details panel '+' buttons; set both types to Float.

Hint 3

For each remaining section, select its nodes and press C, then type a label.

Hint 4

Double-click any awkward wire to drop a reroute node, then drag it to bend the wire out of the way.

QuizCheck yourself

1What's the main reason to turn a repeated chunk of nodes into a function?

2You select a few nodes and press C. What happens?

3What does a reroute node do to the signal travelling along a wire?

You can now

Tick these off — they're the habits of a readable Blueprint:

  • Collapse a group of nodes into a reusable function and rename it for what it does
  • Add inputs and outputs so a function works with different values and hands a result back
  • Press C to box and label each section of a graph
  • Drop reroute nodes to straighten long, crossing wires
  • Compile to a green tick and recognise when to use a function over plain Collapse Nodes
Finished the steps?

Mark this lesson complete

We'll remember it on your Academy page and unlock the next lesson below.

Next lesson →Make a Collectible: Overlap, Pick It Up, and Score

Questions beginners ask

Will collapsing nodes into a function change how my game behaves?

No. Collapsing moves the same nodes into a function's own graph and calls them from a single node in their place — the logic that runs is identical. Comment boxes and reroute nodes likewise change nothing about behaviour; they're purely for readability.

What's the difference between a function and a macro?

They overlap a lot for a beginner, and the differences (such as how each handles certain flow-control and timing cases) only matter once you're more advanced. Default to 'Collapse to Function' for now — functions have clean inputs and outputs and are the easiest habit to build. You can explore macros later.

My function node shows a red error after I collapsed it. What happened?

Usually a wire that was feeding the selected nodes got left dangling, or a value the chunk needed wasn't turned into an input. Open the function, check that everything it relies on is either an input pin or available on the Blueprint, reconnect anything loose, then Compile again.

How do I delete a comment box without deleting the nodes inside it?

Click the comment box's title bar to select just the box (not its contents), then press Delete. The nodes inside stay put. If you select the box by dragging over it, you may grab the nodes too — so click the title bar specifically.

Get the next lessons as they land

New Academy lessons, UE5 tips and tool releases — straight to your inbox. No spam, unsubscribe anytime.

Report a bug