execute_python
Execute Python code inside the Unreal Editor to automate tasks, manipulate actors and assets, and capture log output or evaluate expressions for immediate results.
Instructions
Run Python inside the running Unreal Editor.
With evaluate=False (default) code is run as statements and the
captured log/print output is returned. With evaluate=True code
must be a single expression and its value's repr is returned.
The unreal module is already imported in the editor's interpreter.
Example (statements):
import unreal
for a in unreal.get_editor_subsystem(unreal.EditorActorSubsystem).get_all_level_actors():
unreal.log(a.get_actor_label())
Example (evaluate=True):
len(unreal.get_editor_subsystem(unreal.EditorActorSubsystem).get_all_level_actors())
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| evaluate | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |