Skip to content

Cleanup

Clean up removes what your Blueprints don’t use: unused variables and functions, nodes that never run, disabled nodes, and pure nodes and reroutes whose output goes nowhere. You see a preview first and decide item by item. The whole cleanup is one Undo step.

  1. Scan the project or a selection in the panel.

  2. Click Clean up:

    • next to the search box on the Blueprints page, for every Blueprint in the list as it is filtered right now, or
    • in the details of a selected Blueprint, for that Blueprint only.
  3. Check the preview. Tick or untick items, then click Remove N items.

  4. Check the result in the Blueprint editor. Save the Blueprints to keep it, or press Ctrl+Z to undo it.

Structures and enums are skipped. Clean up in the details is not available for structures, enums and Blueprint Interfaces. If there is nothing to remove, no preview opens and the status line says “Nothing to clean up: no unused variables or functions, and no dead, disabled or disconnected nodes.”

The preview opens as a window titled ta Blueprint Scribe: Clean up, with the heading Clean up N Blueprints and a summary such as “5 items can go. 4 items look unused but are kept, because something outside the graphs may use them. Public members are not ticked: tick them if they are not meant for later.”

The checklist shows the items that can go first, then the items that are kept:

Column Shows
Checkbox Ticked items are removed. Kept items are never ticked and are not removed even if you tick them. The checkbox in the header ticks or unticks every item that can go.
Kind Variable, Function, Dead node, Disabled node or Unused node
Name Variable or function name, or the node title
Source / Path The Blueprint, and for nodes the graph (BP_Door / EventGraph)
Reason Why the item can go, or, in amber, why it is kept

Below the list: Tick all, Untick all, Remove N items (enabled when at least one item is ticked) and Cancel, which closes the window without changing anything.

Kind Removed when Reason shown
Dead node Nothing is connected to its exec input “Nothing is connected to its exec input, it never runs.”
Dead node It only runs after nodes that never run “Only runs after nodes that never run.”
Disabled node It is disabled in the graph and nothing else needs it “Disabled in the graph, it never runs.”
Disabled node It is disabled and sits in a running flow with one exec input and one connected exec output “Disabled in the graph; the flow is connected around it.”
Unused node A pure node or reroute whose output is not connected “Its output is not connected.”
Unused node A pure node or reroute that only feeds nodes that are removed “Only feeds nodes that are removed.”
Function A private function that is never called “Private and never called.”
Variable A private variable that no graph reads or writes, and that is not Instance Editable, Expose on Spawn or Expose to Cinematics “Private and no graph reads or writes it.”

A disabled node inside a running flow is taken out and the node before it is connected straight to the node after it, so the flow keeps working as it did while the node was disabled.

A function counts as used when a graph of the Blueprint calls it, binds it to a delegate (Create Event), or names it in a pin, for example as the function name of Set Timer by Function Name, or when it is the RepNotify function of a variable. Event dispatchers are never removed.

A public function or variable that is never used in the Blueprint may be meant as an API for other Blueprints. Blueprint Scribe checks which assets use the Blueprint (in the Asset Registry, and among loaded Blueprints with unsaved changes):

  • Other assets use the Blueprint: the item is kept. Reason: “Public, and N other assets use this Blueprint; they may use it.”
  • No other asset uses it yet: the item can go, but it is not ticked. Reason: “Public and never called; no other asset uses this Blueprint yet. Tick it if it is not meant for later.” (for variables: “Public and no graph reads or writes it; …”).
  • Events, function entry and result nodes, the inputs and outputs of macros and collapsed graphs, comment boxes, and nodes that start a flow on their own (input actions, key events).
  • The Construction Script.
  • Overrides of functions of the parent class: the engine or the parent class calls them.
  • Event dispatchers.
  • Level Blueprints and Blueprint Interfaces.

These items are listed in the preview but kept, with the reason:

Kept Reason
Call In Editor functions “Call In Editor: it is a button in the Details panel.”
Config and SaveGame variables “Config or SaveGame variable: ini files and save games use it outside the graphs.”
Instance Editable variables, public or private “Instance Editable: placed instances or spawners may set it.”
Expose on Spawn variables, public or private “Expose on Spawn: Spawn Actor nodes in other Blueprints may set it.” Shown instead of the Instance Editable reason when a variable is both.
Expose to Cinematics variables, public or private “Expose to Cinematics: Level Sequences may animate it.”
Unused functions and variables of Widget and Animation Blueprints They can be used in bindings and the Anim Graph; “remove it by hand.”
A disabled node whose output other nodes still read “Disabled, but other nodes still read its output.”
A disabled node next to another disabled node in a running flow “…remove them by hand.”
A disabled node with several exec pins in a running flow “…remove it by hand.”
A Blueprint that does not compile “Does not compile. Fix the errors first, then clean up.” Nothing else of that Blueprint is offered.
  • One Undo step. Everything removed in one cleanup, in all Blueprints, is a single transaction named “ta Blueprint Scribe: Clean up Blueprints”. Ctrl+Z (or Edit > Undo) brings it all back.
  • Compiled, not saved. The changed Blueprints are compiled right away but not saved. They show as modified; save them when you are happy with the result. Until you save, the files on disk are unchanged.
  • No backups. Blueprint Scribe makes no backup copies. After you save, use source control or the editor’s own backups to go back.
  • Checked again before removing. When you click Remove, every Blueprint is checked again. Items that are no longer safe, for example because you changed the Blueprint after the preview, are skipped and logged in the Output Log (“Cleanup skipped …”).

After a cleanup the panel scans again and the status line says, for example, “Removed 5 items from 1 Blueprint. Ctrl+Z undoes it; save the Blueprints to keep it.” If items were skipped: “Removed 4 items from 1 Blueprint; 1 skipped (see the Output Log). Ctrl+Z undoes it.”

import unreal
scribe = unreal.get_editor_subsystem(unreal.TABlueprintScribeSubsystem)
report = scribe.scan_paths(["/Game/Blueprints"], False)
items = scribe.find_cleanup([report.assets[0].object_path])
for item in items:
print(item.kind, item.name, item.safe, item.selected, item.reason)
result = scribe.apply_cleanup(items) # removes the safe, ticked items (one Undo step)
print(result.removed, "removed from", len(result.changed_assets), "Blueprints")

apply_cleanup removes items that are safe and selected, and doesn’t save. open_cleanup_preview(assets) opens the preview window for a scanned set of assets. See Python.