Blueprint Nativization (C++ converter)

Hey guys,
In 4.12 there is new experimental feature: Blueprint Nativization.(Some of you already found it in 4.11, but it wasn’t ready to be announced).

What does the feature do?

  • Generates c++ code from Blueprints
  • Compiles the project with the generated code (only non-editor builds)
  • Cooks the project with BlueprintGeneratedClasses replaced by newly generated native classes

The main goal of the feature is to reduce the VM overhead in runtime.
The aim of the feature (so far) is not to generate readable/friendly/reusable code.
This is an experimental beta feature. All UE4 sample games and some medium size demos were successfully nativized, but we’re still working on using the feature with the biggest projects (Paragon).

How to use the feature?

  • In editor enable checkbox: Edit > Project Settings > Packaging > Nativize Blueprint Assets
  • If you use UAT scripts, add “-nativizeAssets” switch in BuildCookRun command line.

What assets are converted:

  • Blueprints (classes, function libraries, interfaces),
  • Anim Blueprints,
  • Widget Blueprints,
  • User Defined Structures,
  • User Defined Enums

What assets are not converted:

  • Level Blueprints
  • Any manually excluded Blueprints

C++ cooperation
If your project contains C++ code, make sure that all headers are properly included in your source code.
There are some rules/restrictions that help make cooperation between manually written code and the nativized code more reliable and efficient.
Do not use:

  • private/protected properties with BP-Visible or Editable tags
  • private/protected functions callable from BP
  • noexport structures/classes
  • bit-fields properties with BP-Visible or Editable tags
  • private bit-fields properties
  • properties of types: UBlueprintGeneratedClass, UUserDefinedStruct, UUserDefinedEnum (or any type based on them)

How to exclude blueprints from nativization?
In DefaultEditor.ini in [BlueprintNativizationSettings] sections there are:

  • ExcludedBlueprintTypes (sample usage: “+ExcludedBlueprintTypes=/Script/UMGEditor.WidgetBlueprint”)
  • ExcludedAssets (sample usage: “+ExcludedAssets=/Engine/Tutorial/SubEditors/TutorialAssets/Character/TutorialCharacter”)

Technical details/Misc:

  • The feature should work both with VS2013 and VS2015. VS2015 is strongly recommended, especially for bigger projects. A big problem is the size of generated library. VS 2015 handles it much better. If there is a strange compiler/linker error like LNK1000, LNK1248, then try to reduce the amount of nativized Blueprints.
  • The nativized code is stored in *<project>\Intermediate&lt;platform>\NativizedAssets\Source\NativizedAssets\ *(the path was changed since 4.11)
  • The BlueprintCompilerCppBackend module converts Blueprint syntax tree into C++. *Engine\Source\Developer\BlueprintCompilerCppBackend*
  • The BlueprintNativeCodeGen module does a lot of magic while cooking and packaging. *Engine\Source\Developer\BlueprintNativeCodeGen*
  • Assets are nativized if (and only if) they are cooked. When the cooker has no assets/maps specified (to be cooked) it cooks everything from content directory. So if you see some unused blueprints nativized, try to fill “Project Settings > Packaging > List of maps to include in a packaged build” (or MapsToCook in DefaultGame.ini).

How to debug the converted code?
If you nativize a BP-only project, then (after nativization) run GenerateProjectFiles.bat. It will add a new project to UE4 VS solution. Do not use this project to compile anything in VS. Also do not use this project to run Editor.

  1. To build a debug .exe file run the following lines. They can be found in log output, when nativized build is packaged (but instead of Debug there is Development switch). It’s better to copy them, so all switches are proper for your environment.

"<UE4>\Engine\Binaries\DotNET\UnrealBuildTool.exe" <project name> Win64 Debug -Project=<project path>\<project name>.uproject <project path>\<project name>.uproject -PLUGIN "<project path>\Intermediate\<platform>\NativizedAssets\NativizedAssets.uplugin" -remoteini="<project path>" -noxge -generatemanifest -NoHotReloadFromIDE -ignorejunk 

"<UE4>\Engine\Binaries\DotNET\UnrealBuildTool.exe" <project name> Win64 Debug -Project=<project path>\<project name>.uproject <project path>\<project name>.uproject -PLUGIN "<project path>\Intermediate\<platform>\NativizedAssets\NativizedAssets.uplugin" -remoteini="<project path>" -noxge -NoHotReloadFromIDE -ignorejunk

  1. Set Working Directory in VS project (debug configuration) to *<Packaged Folder>&lt;platform>&lt;project name>\Binaries\Win64*
  2. Run debug in VS (do not recompile the project from VS).


Great work :slight_smile: Im really looking forward to using this and Im expecting it to make a real difference in some of the more computationally expensive parts of my BPs. Basically I can write CPP but it was just too tedious to try and manage both CPP and BP end of thing especially for smaller projects where CPP is kinda overkill. Id really like to see a light weight text scripting system like UScript be built ontop of Blueprint and Slate, so instead of displaying nodes it displays it as text, this way we can get some speed improvement if we need to say type a long expression we can flick back and forward between script/node view.

I do think the RMB shortcut menu could be sped up by making enter (or another key) a way to bring up the menu as well as the RMB, so you can more continually type without baby sitting the mouse for the next node creation.

Anyway I really like where you guys are going with all of these Blueprint improvements so thank you and totally looking forward to future releases :cool:

Could this thread be sticked? :wink: Or will the information from this post be included in engine documentation? :slight_smile:

Very cool!


As soon as I get my rig back up and running here in a couple weeks I will see if I can get this working on my generator just to see what kind of performance gains I see.

Some of my bigger maps with 10-80,000 tiles can require billions of iterations and take several minutes to complete, so seeing gains of 5-10x as has been reported in other threads would be amazing. :slight_smile:

Will this also work on android builds? Last time I tried, it gave me some errors…

The information will be included in engine documentation. I wanted to post it as soon as 4.12 preview is ready.

The generated code is platform-agnostic. The feature should (hopefully) support all platforms.

Hello @kaziu!
Can you please explain, what does it give in practice?
I created two mobile TopDown projects, then deployed them - first without this feature, second with.
Tested on an Android device(Samsung Galaxy Ace Style). And I got 29-31 FPS and 16-18ms on both.

Converting blueprint to C++ reduces the amount of overhead you get from executing blueprint code. While C++ is ~10x faster, if you are not doing a lot of work in a very short amount of time, such as in a single frame, you may not see a difference. Blueprint is still relatively fast for most uses.

Just a heads up for those who are trying to nativize a converted project: Nativizing Blueprints not working, NativizedAssets.uplugin not found - UE4 AnswerHub
It seems to be buggy atm.

EDIT: Has been fixed with 4.12P2

this is awesome. i heard a year ago that blueprint code is running like 30 times slower than c++ (?). this would be a huge improvement.

Is this Windows only ATM? I’m trying to do this on a mac and packaging is throwing tons of errors and failing. I’m running OS X 10.11.5, XCode 7.3.1, and of course UE4 4.12.0. Just curious if anyone’s tried this on a mac yet… Cheers,


Is this supposed to only work in a packaged game, or should it work in the stand alone client as well?

Only packaged.

You probably won’t get the same performance out of a “nativized” blueprint that you would get out of a similarly hand-coded C++ game file.
The reason is that Blueprint derived C++ must make sure to adhere to the Blueprint rules of execution, flow, etc, so it will likely generate more and more cumbersome code than a C++ programmer would write by hand.
That being said – from what I can tell, it should speed up blueprints, and in the future, I hope we can choose to “convert blueprint to C++” and then start hand-editing the generated code to make it great again.

Hello everybody!
I have a problem when package my game with nativize blueprint assets

Hey guys! Please, take a look at my problem, really cant do much

This feature can be used on Mac. I’m running OS X 10.11.5, XCode 7.3.1, and UE4 4.12.3.

Hello everybody! Can I compile a dedicated server game with nativize blueprint assets? Thanks !

How can I compile my game in dedicated server mode with nativize blueprint?