The C++ / Blueprint Split
"Should this be C++ or Blueprint?" comes up every day on an Unreal team. There is no single right answer, but there is a well-tested default, and some clear signs for each side.
The default architecture
C++ Blueprint subclass Level / data
------------------------------- ------------------------------- ---------------------
AArenaCharacter BP_ArenaCharacter placed in L_Arena
components, movement setup mesh, AnimBP, sounds, VFX
health, abilities, replication tuning values (speed, HP)
BlueprintImplementableEvents -> cosmetic reactions (OnHit, OnDied)
UArenaWeaponData (UDataAsset) DA_Rifle, DA_Shotgun (assets) chosen per character- C++ owns systems and data layouts: base classes, components, replication, anything with loops over many objects, anything other code depends on, anything that must be diffed and reviewed in text.
- Blueprints own content and glue: which mesh, which sound, which numbers; one-off level events; UI layout; quick prototypes; visual timelines.
- Data assets (
UPrimaryDataAssetsubclasses edited as assets) hold tables of numbers that designers balance without touching either.
Signs something belongs in C++
| Sign | Why |
|---|---|
| it runs every frame on many actors | Blueprint VM calls cost far more than native calls |
| it loops over hundreds of elements | the same, multiplied by the loop |
| other C++ code needs to call it | C++ can't easily call functions defined only in a Blueprint |
| it replicates or needs RPCs | easier to reason about, review and debug in code |
| it's math-heavy or algorithmic | a 40-node graph is a 6-line function |
| two people will edit it at once | .uasset files are binary: they can't be merged, only locked |
Signs it belongs in a Blueprint (Blueprints are the better tool here)
| Sign | Why |
|---|---|
| it references specific assets | hard-coding asset paths in C++ is brittle; Blueprints pick assets in the editor |
| a designer will iterate on it | no compile, instant feedback, no programmer in the loop |
| it's a one-off level script | a door that opens when this lever is pulled in this level |
| it's a timeline or visual sequence | Timeline nodes, curves and Sequencer are made for this |
| it's UI layout and animation | UMG's designer is far better than building widgets in code |
| it's an early prototype | find the fun first, move it to C++ when it stabilizes |
The cost of Blueprint logic, modelled
The Blueprint VM interprets compiled bytecode. Each node costs an interpreter step plus a function call through reflection; a native call is a direct call that the optimizer can inline. The ratio depends heavily on the node, so treat these numbers as an illustration, not a benchmark. The shape is the point: per-node overhead times nodes times actors times frames.
#include <iostream>
#include <iomanip>
int main() {
// Illustrative costs in nanoseconds (assumptions, not measurements).
const double nativeCallNs = 5, bpNodeNs = 120;
const int nodesPerTick = 25; // a modest Tick graph
const double frameBudgetMs = 16.67;
std::cout << std::fixed << std::setprecision(3);
std::cout << "actors C++ (ms) Blueprint (ms) BP share of 60 FPS frame\n";
for (int actors : {10, 100, 500, 2000}) {
double cppMs = actors * nodesPerTick * nativeCallNs / 1e6;
double bpMs = actors * nodesPerTick * bpNodeNs / 1e6;
std::cout << std::setw(6) << actors << std::setw(10) << cppMs << std::setw(16) << bpMs
<< std::setw(14) << std::setprecision(1) << 100 * bpMs / frameBudgetMs << " %\n"
<< std::setprecision(3);
}
}actors C++ (ms) Blueprint (ms) BP share of 60 FPS frame
10 0.001 0.030 0.2 %
100 0.013 0.300 1.8 %
500 0.062 1.500 9.0 %
2000 0.250 6.000 36.0 %
Ten Blueprint actors ticking is noise. Two thousand is a third of the frame. Measure your own case with Unreal Insights (Profiling) before deciding. Then move the hot part to C++ and keep the graph as a thin caller.
Moving a Blueprint function to C++
- Write the C++ function in the Blueprint's parent class as
BlueprintCallable(or aBlueprintNativeEventif subclasses need to override it). - Compile, then in the Blueprint replace the graph's body with a call to the new node (or right-click the old function → Replace References).
- Keep the same name and parameters if other Blueprints call it, to avoid touching every caller.
Reparenting (Class Settings → Parent Class) moves an existing Blueprint onto a new C++ base. Do it on a branch: variables with the same name in the Blueprint and the new parent collide.
Blueprint Nativization is gone
UE4 had Blueprint Nativization, which converted Blueprints to C++ at package time. It was removed in UE5. If a Blueprint is too slow, a programmer rewrites the hot part by hand.
Test yourself
Which task is the better fit for a Blueprint?
- A pathfinding loop over 500 agents
- Choosing which mesh, sound and VFX a weapon uses
- Replicated inventory logic
- A math-heavy aim-assist algorithm
Why is merging two people's edits to the same Blueprint a problem?
- Blueprints are encrypted
- .uasset files are binary, so they can't be merged; use locking
- Blueprints can't be saved twice
- Git refuses Blueprints
What replaced Blueprint Nativization in UE5?
- Automatic JIT
- Nothing: it was removed; rewrite hot paths in C++ by hand
- Verse
- Live Coding