This project explores the use of Python to interact with, manage, and extend aspects of Unreal Engine 5
This project is meant to supplement the official Epic documentation on Python and is unaffiliated with Epic or any company. This project is written and maintained by Brian Kortbus. This project is meant to provide examples of how Unreal's systems can be used via Python and explore what's possible. This project is considered incomplete, new pages and revisions will be added as time allows. We will also try to update this whenever a new version of Unreal is released, although it may not be available right away.
Please feel free to learn from and reference this project as you explore Python in Unreal!
There are two sections of this Project:
- Documentation covering various topics of using Python in Unreal
- An Unreal Plugin containing working code and demo material
which may be placed in any
UE5.2
project
The Python Documentation covers the Python code provided in the Unreal Plugin for various topics. The focus of this documentation is on working examples, it is recommended readers already be familiar with both Unreal Engine and Python.
Currently available pages:
(0) Dev Conveniences |
Some small conveniences I've found and make use of in my own code. |
How to run code at various points of Unreal's startup and shutdown sequences. | |
How to create Blueprint Graph function nodes in Python. This allows us far greater freedom and possibilities to call Python logic from the BP Graph. Examples with screenshots are provided for each individual option. | |
How to interact with Content Browser assets in Python. This covers instancing, properties, and calling Blueprint functions. | |
(4) Extending Menus |
How to create and insert new menus in the Editor. This covers how to find menus, create drop down menus, and two styles of adding menu buttons. |
How to interact with actors and components. This covers walking actor and component hierarchies as well as some basic interactions, such as determining the source asset of an actor. | |
How to use and interact with Content Browser Asset metadata. This covers getting, setting, and searching for assets via metadata. | |
How to manage EUWs with Python. This covers opening and closing EUWs, managing user prefs, and a danger when using EUWs with Python. | |
An example Editor Tool which makes use of Python. This tool displays arbitrary assets and allows for filtering based on their metadata values. | |
Addressing the concerns mentioned on the Blueprint Function Libraries and EUWs and Python pages, this covers how to make Python-based Blueprint Functions safer to use. | |
Methods to handle supporting or transitioning between Unreal versions. This covers a utility class for having version-specific Python logic as well as a method to see what classes & properties have been added to the Unreal Python API |
- Python modules for all Documentation topics covered
- c++ code exposing key some useful functionality to Python
- A config ini to declare the metadata used by the the provided assets and
meta_viewer
- An Editor Utility Widget,
meta_viewer
, to demo using Python in UMG - A collection of arbitrary demo assets with metadata tags used by
meta_viewer
- An arbitrary 3D level that was used to test actor/component inspection
The provided PythonRecipeBook plugin contains all of the code covered in the Documentation. It may be added to any Unreal 5.2 project to demo the topics covered or review how the various parts work in practice.
The plugin contains the following:
Feel free to demo the meta_viewer
tool in Unreal, dig into the Plugin modules, and try expanding functionality!
Rajesh Sharma
For encouraging me to pick up this project again and keep working on it.
Spire Animation Studios
For providing an environment where I was able to pursue this project.
This project is written and maintained by Brian Kortbus as a personal project. If you have any questions, suggestions, or Unreal code snippets you wish to share please feel free to message me on LinkedIn.
- Added documentation
and a new Python module
on
Handling Engine Version Transitions
- built plugin for UE5.2 and updated doc links - no notable API changes
While updates may be infrequent I do plan to add to and update this project as time allows. Please allow time as new versions of UE5 are released as updates may take time to publish.
13 August 2023
19 June 2023