Skip to content

Latest commit

 

History

History
235 lines (127 loc) · 6.31 KB

README.md

File metadata and controls

235 lines (127 loc) · 6.31 KB



Unreal Python Recipe Book

This project explores the use of Python to interact with, manage, and extend aspects of Unreal Engine 5



Overview

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:

  1. Documentation covering various topics of using Python in Unreal
  2. An Unreal Plugin containing working code and demo material which may be placed in any UE5.2 project

The Documentation

    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.

    (1) Startup and Shutdown

    How to run code at various points of Unreal's startup and shutdown sequences.

    (2) Blueprint Function Libraries

    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.

    (3) Using Assets in Python

    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.

    (5) Actor and Component Interactions

    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.

    (6) Using Asset Metadata

    How to use and interact with Content Browser Asset metadata. This covers getting, setting, and searching for assets via metadata.

    (7) Editor Utility Widgets (EUWs) and Python

    How to manage EUWs with Python. This covers opening and closing EUWs, managing user prefs, and a danger when using EUWs with Python.

    (8) An Editor Utility Widget Example

    An example Editor Tool which makes use of Python. This tool displays arbitrary assets and allows for filtering based on their metadata values.

    (9) Making Python Blueprint Functions Safer

    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.

    (10) Handling Engine Version Transitions

    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


The Unreal Plugin

    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:

    • 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

    Feel free to demo the meta_viewer tool in Unreal, dig into the Plugin modules, and try expanding functionality!


Special Thanks

    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.


Contact

    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.


Updates

    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

      • built plugin for UE5.2 and updated doc links - no notable API changes