Your First Automated Pipeline with UnrealEnginePython
In this tutorial i will try to show you how to build a python script that can generate a new Unreal Engine 4 Blueprint implementing a Kaiju (a big Japanese monster) with its materials and animations. In the second part a simple AI based on Behavior Trees will be added to the Blueprint as well as a bunch of simple unit tests..
Running the script from the Unreal Engine Python Console will result in a native Blueprint (as well as meshes, animations, a blackboard and a behaviour tree graph) that does not require the python plugin to work.
Technically i am showing the "editor scripting" features of the plugin, not its "gameplay scripting" mode.
If this is the first time you use the UnrealEnginePython plugin you should take in account the following notes:
when you see CamelCase in the python code (for attributes and function calls) it means the UE4 reflection system is being used. Albeit CamelCase for variables and functions is not 'pythonic', you should see it as a 'signal' of jumping into UE4 reflection system.
in this tutorial i use the embedded python editor. It is pretty raw, if you want you can use your favourite editor (Vim, Sublime, Emacs...). Anything that can edit python files will be good.
Python scripts are stored in the '/Game/Scripts' folder of the project
The Python code is pretty verbose and repeat itself constantly to show the biggest possible number of api features, i strongly suggest you to reorganize/refactor it if you plan to build something for your own pipeline
It has been tested with version 4.15 of the editor and python 3.6
Obviously the first step is installing the UnrealEnginePyton plugin.
Just take a binary release for your operating system/ue4 version combo and unzip it in the Plugins directory of your project (create it if it does not exist).
You can download binary versions from here:
It is highly suggested to get an embedded one so you do not need to install python in your system. You can start with a Blueprint or a C++ project, both will work.
Once you have unzipped the zip file into the Plugins directory, you can run your project
Ensure the plugin is enabled by opening the Edit/Plugins menu:
tick the 'Enabled' checkbox and confirm the editor restart.
If all goes well, you will get a new option under the Window menu, called the 'Python Console':
Run it, and ensure your python environment works:
In the Window menu, you will find another tool (optional), the Python Editor. It is a very simple editor for managing your project scripts. Obviously feel free to use your favourite editor.