The ue module¶
What is in import ue?
Unreal classes, structs and enums are attributes of ue (ue.Actor, ue.Vector), created on first access from the
engine's reflection data. The functions below are the module's own.
Objects and world¶
| Name | Purpose |
|---|---|
spawn_actor(cls, location=None, rotation=None, *, world=None, owner=None, **properties) |
Spawn an actor. |
new_object(cls, outer=None, name=None, **properties) |
Create a non-actor UObject. |
get_world() |
The game or PIE world, else the editor world, else None. |
find_object(path) |
An already loaded object, or None. |
load_object(path) |
Load an object by path, or None. |
find_type(name) |
A class or struct by short name or path. |
invoke_by_name(obj, name, *args) |
Call a UFunction by its Unreal name. |
enum_value(enum_name, value_name) |
Integer value of an enum entry. |
line_trace(world, start, end, channel, ignore, trace_complex) |
One ray; None on a miss. |
line_trace_batch(world, segments, ...) |
Many rays in one native call. |
batch_math(method, objects) |
A pure getter over many objects into one array. |
to_unreal(obj), from_unreal(obj) |
Convert to and from Epic's unreal module wrappers (editor). |
Types¶
ue.Object, ue.StructBase, ue.StaleObjectError, ue.Delegate, ue.MulticastDelegate, ue.SoftObjectPtr,
ue.SoftClassPtr. See Load assets and soft references for using the pointer types.
Environment¶
| Name | Purpose |
|---|---|
log(message, level), warning, error |
Write to the log (LogUnrealPy). |
host_mode() |
"EpicHosted", "SelfHosted" or "None": who owns the interpreter. |
is_editor() |
Whether this is an editor process. |
engine_version(), project_dir(), engine_dir(), saved_dir() |
Where things are. |
command_line(), has_param(name), get_param(name) |
The engine command line (-name=value). |
call_on_next_tick(callback) |
Run a callback on the game thread at the next tick. |
request_exit(code=0, *, force=False) |
Ask the engine to exit. |
Scripting¶
uclass, uproperty, ufunction, udelegate, uenum, ustruct, component, script, reload. See
Decorators. Additional helpers live in ue.scripting: bind, unbind, create_script,
script_base.
Submodules¶
ue.numpy_types supplies annotations for math values. Use ue.assets to reference assets and Blueprint classes.