Unreal Engine 5 · Blueprint → C++
Gate Node in Unreal Engine 5 C++UE Docs
The Blueprint Gate node lets execution pass only while it is open. In C++ you model it with a bool bGateOpen flag that Open() and Close() toggle, checked by if (bGateOpen).
Blueprint node & C++ equivalent
// .h
bool bGateOpen = false; // Open()/Close() toggle this
// .cpp
if (bGateOpen)
{
// passes only while the gate is open
}What does the Gate node do?
A Gate has Enter, Open, Close, and Toggle inputs. Execution arriving at Enter passes through only when the gate is currently open; while closed, the Enter call is dropped. Open and Close change that state without passing execution themselves, so the gate acts like a switch that other code controls.
The C++ equivalent
Store the state as a bool bGateOpen = false; member in the header. Provide simple Open() and Close() functions that set the flag true or false. Wherever the Enter pin would feed logic, wrap it in if (bGateOpen) { ... } so the body only runs while the gate is open.
When to use it
A gate is useful when one part of your code enables or disables a stream of events, such as allowing damage only during an active phase. Keeping bGateOpen as a member lets any function open or close the gate, while the guarded block stays in whichever method handles the recurring event.
Frequently asked questions
What is the C++ equivalent of the Blueprint Gate node?+
A boolean flag such as bGateOpen, toggled by Open and Close functions and checked with if (bGateOpen) before the gated logic runs.
How is a Gate different from Do Once in C++?+
Do Once passes exactly once until reset, while a Gate can be opened and closed repeatedly, passing execution every time it is open.