Switch (Inverse)
The Boolean Switch, Flipped
- on_true
- on_false
- output
A switch node routes one of two inputs to an output based on a boolean - the ComfyUI equivalent of an if/else. UC_SwitchInverseNode is that same switch with the branches presented the other way around. If you've ever wired a standard Switch and found yourself always selecting the "wrong" branch because your mental model of the toggle is inverted, this is the node that un-confuses the canvas.
What "inverse" actually means here
Let's be precise, because the naming invites a wrong guess. ComfyUI core's Switch node (ComfySwitchNode in comfy_extras.nodes_logic) has two branch sockets - on_false on top, on_true below - and returns on_true when the switch is ON. This node inherits that exact behavior but declares its schema with on_true on top and on_false below. So the labels and positions are inverted relative to the core switch while the data flow stays identical.
In practice that means: if you're the kind of person who wires by socket position - "top branch is the normal case, bottom is the alternative" - the inverse node makes the top socket the on_true branch, which is the opposite of what a core Switch gives you at the same position. If your instincts say "top = on," this node is the one that agrees with you.
How it works
Three inputs: switch (BOOLEAN), plus on_true and on_false - both match-type sockets, meaning they accept any type, so you can route IMAGE, LATENT, STRING, a model, whatever. The output is the same match type, so it's type-safe to whatever you connect it to. It's marked experimental in the schema, but the mechanism is bedrock ComfyUI: the engine only asks the upstream of the branch that's actually selected, so the dead branch's expensive nodes never execute. That lazy evaluation is the real feature - you can park two model loaders behind a switch and only the chosen one gets loaded.
Installing it
It's part of ComfyUI-UtilsCollection by silveroxides:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart ComfyUI, or install "ComfyUI-UtilsCollection" via Manager. The pack's requirements (opencv-python, typing-extensions) don't even touch this node - it's a thin subclass of a core node.
Do you actually need it?
Honestly, no - not uniquely. Core ships a Switch, rgthree's any-switch does more, and the pack's own UC_LogicIF covers the boolean-if use case. Where this earns its keep is readability: when your graph already uses the inverse convention elsewhere, or when the core switch's socket order keeps tripping you, a node that matches how you think beats one you keep second-guessing. The one thing to watch: since behavior is identical to core's switch, don't expect it to change which branch runs - it only changes the framing of the sockets. If you wire it expecting true inversion of the logic, you'll get a genuinely confusing surprise.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| switch | BOOLEAN | — | |
| on_true | COMFY_MATCHTYPE_V3 | — | |
| on_false | COMFY_MATCHTYPE_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output | COMFY_MATCHTYPE_V3 | — |