๐ Universal Switch
The Universal Switch, or how to make ComfyUI stop jumping around
- input1
- input2
- input3
- input4
- input5
- input6
- *
- *
- *
- *
- *
- *
๐ Universal Switch is the node this pack is best known for, and the one people write appreciation posts about. It's a router: up to six inputs in, six outputs out, and a set of modes that decide how inputs get matched to outputs. With a couple of clicks you can build workflows that route different models to different sections, pack all inputs into a list, broadcast one value everywhere, or simply force a pile of branches to finish before anything downstream starts.
The last one is the trick most people miss, and it's the one redditors actually rave about. ComfyUI is eager about execution - it runs whatever's ready and sometimes reloads models out of order, which nukes your generation times. One well-known post in r/comfyui credits this node for exactly that: feed the pieces you want done "together" into it in PASSTHROUGH mode and it acts as a synchronization barrier, so ComfyUI can't proceed downstream until that whole stage is finished. "No more going back and forth loading models out of turn," in the author's words.
How it works
Pick a mode, then tell it which input to read and which output to write:
- SWITCH - transmit the input chosen by
selection_into the output chosen byselection_out. The classic router. - CYCLE - like SWITCH but keeps matching subsequent inputs to subsequent outputs, wrapping around. Handy for pairing a list of models with a list of slots.
- PASSTHROUGH - every input goes to its matching output, straight across. This is the synchronization barrier trick.
- SORT - sort the inputs and match them to outputs.
- REVERSE - match inputs to outputs in inverse order.
The two selection widgets do the work. selection_in and selection_out each run from -1 to 6. The magic numbers: 0 means "auto" (pick the first input that isn't None, or the first output with a live connection), and -1 means "all" - pack every input into a list, or broadcast one value to every output. Set both to -1 and it's equivalent to passthrough. Left on defaults (both 1), it's a simple single-to-single switch.
The genuinely modern feature is lazy evaluation. In SWITCH mode the node tells ComfyUI exactly which input it needs, and ComfyUI doesn't execute the branches feeding the unselected inputs at all. That's what makes this the right tool for model routing: you can hang a Flux chain and a Wan chain off the same switch, and only the one you select actually runs - no wasted generation, no wasted VRAM on the loser.
What to wire where
- input1โ6 - anything.
*type, so models, latents, strings, images all pass through. Unconnected inputs arrive asNone. - mode - one of the five above.
- selection_in / selection_out - the router settings.
- validate_typing - ignore it; it's explicitly marked
[UNIMPLEMENTED]in the code and does nothing yet. - Outputs 1โ6 - the routed values. Unused outputs return
None.
Putting it together
The classic build: a model selection (from this pack's Model Selector, or a boolean from Simple Toggle run through an IF selector) drives selection_in, and the switch forwards the right checkpoint to a loader. Because of lazy evaluation, the workflow actually feels different from a static graph - branches genuinely don't run when unselected. Reddit users have used it for Flux-before-Wan multi-model pipelines and iterative looping, and the pack's sample workflow images show it wired into fallback image previews and memory storages.
Install and gotchas
No dependencies beyond the pack itself:
cd ComfyUI/custom_nodes
git clone https://github.com/VykosX/ControlFlowUtils
or ComfyUI Manager โ search ControlFlowUtils โ install โ restart.
Watch out for a couple of footguns. REVERSE mode expects None inputs to be handled by the receiving nodes - routing garbage in gets garbage out. And remember that unselected outputs come through as None, so if a downstream node chokes on None, that's the switch "working"; give that path a fallback or a Null Output to make the intent explicit. The pack is alpha (v0.0.6), and the reddit appreciation threads mention the loop/switch nodes are occasionally a little rough around the edges but workable - if a workflow misbehaves, blame execution order first and check the wiki's in-depth node explanation, which is where most people land when they're stuck.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | * | Data to forward through the Universal Switch | |
| mode | COMBO | Mode that will be used to select Inputs and Outputs | |
| selection_in | INT | 1-1โ6 | Which Input slot to select from (0=Auto,-1=All) |
| selection_out | INT | 1-1โ6 | Which Output slot to transmit to (0=Auto,-1=All) |
| validate_typing | BOOLEAN | [UNIMPLEMENTED] Match Input types to their relative Outputs | |
| input2opt | * | Data to forward through the Universal Switch | |
| input3opt | * | Data to forward through the Universal Switch | |
| input4opt | * | Data to forward through the Universal Switch | |
| input5opt | * | Data to forward through the Universal Switch | |
| input6opt | * | Data to forward through the Universal Switch |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| * | * | Output 1 |
| * | * | Output 2 |
| * | * | Output 3 |
| * | * | Output 4 |
| * | * | Output 5 |
| * | * | Output 6 |