Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Attributes

Every attribute Rusteal’s macros accept. Anything not listed here is a compile error, with a message naming what is accepted.

#[uclass(...)]

On a struct: the struct is an Unreal class.

ArgumentRequiredWhat it is
parent = TypeyesThe parent class: an engine class from the bindings, or a Rust class.
implements = [Trait, "path", ...]noUnreal interfaces the class implements: other interfaces by class path, and #[uinterface] traits (after 0.7.0). See Interfaces.
config = "Category"noThe config category its Config properties are read from and saved to. See Project settings and config.

#[uproperty(...)]

On a field of a #[uclass] or a #[ustruct]: the field is an Unreal property.

ArgumentWhat it is
EditAnywhereEditable on the class defaults and on each instance.
EditDefaultsOnlyEditable on the class defaults only.
VisibleAnywhereShown, read-only.
BlueprintReadWriteGet and Set nodes in Blueprints.
BlueprintReadOnlyA Get node in Blueprints.
SaveGameWritten by save game archives.
ConfigRead from and saved to the class’s config category.
BindWidgetOn a UserWidget class: the widget of the same name in the Widget Blueprint’s layout, which must have one.
BindWidgetOptionalThe same, when the layout may leave it out.
BindWidgetAnimOn a UserWidget class: the Widget Blueprint’s animation of the same name (a UObjectRef<WidgetAnimation>); it makes the property Transient.
BindWidgetAnimOptionalThe same, when the Widget Blueprint may not have it.
TransientNot saved with the object or its class defaults.
default = valueThe default value, for scalars, engine enums and #[uenum]s (not in a #[ustruct]).
name = "Name"The Unreal name.
category = "Category"The category in the Details panel; `“A

See Properties.

#[component(...)]

On a field of a #[uclass]: the field is a default subobject, created with every instance.

ArgumentWhat it is
rootThe actor’s root component.
attach = "field"The component it attaches to: a field of the class, of a Rust parent, or an inherited engine component by field-style name (root_component, mesh).
socket = "Socket"The socket on the parent component.
name = "Name"The component’s name, when it is not the field’s.

See Components.

A field with no attribute

Rust’s alone: any Rust type, a getter returning a clone, a set_ setter and a _mut accessor. Reset by hot reload, invisible to the garbage collector.

#[uclass_impl]

On an impl block of a #[uclass]: its marked methods are the class’s Unreal functions, events, delegates and defaults. A class can have several.

On the implementation of a #[uinterface] trait for a #[uclass] (impl Interactable for Door): the class implements the interface, and every method is its function of the same name, with no attribute.

#[uinterface]

Not released yet: it comes in a release after 0.7.0.

On a trait, with no arguments: the trait is an Unreal interface, Blueprint-implementable, whose functions are Blueprint events. Its functions take &self or &mut self, then #[ufunction] parameter types, return a #[ufunction] return type, and have no body; the trait has no generics and no supertraits. See Interfaces.

#[ufunction(...)]

On a method in a #[uclass_impl] block.

ArgumentWhat it is
(none), BlueprintCallableA function with execution pins, callable by name.
BlueprintPureA function without execution pins.
BlueprintImplementableEventAn event the Blueprint child implements; empty body.
OverrideAn event of the parent class implemented in Rust.
ExecAlso a console command (with the default kind or BlueprintPure).
name = "Name"The Unreal name.

Override, BlueprintPure and BlueprintImplementableEvent exclude each other. See Functions and Engine events.

#[udelegate] and #[udelegate(name = "Name")]

On a method with an empty body in a #[uclass_impl] block: a multicast delegate, assignable from Blueprints. Calling it broadcasts; <name>_add(closure) and <name>_add_ufunction(&target, "Function") bind Rust listeners. See Delegates.

#[class_defaults]

On a method in a #[uclass_impl] block, returning RustealResult<()> or nothing: runs once on the class default object. See Class defaults.

#[ustruct]

On a struct whose fields are all #[uproperty]: an Unreal struct, with a <Name>Ext trait of getters and setters. See Structs and data tables.

#[uenum]

On an enum whose variants carry no data: an Unreal enum, usable in Blueprints, with values up to 254. See Enums.

Macros

MacroWhat it does
rusteal_runtime::entry!()Once per library, in lib.rs: the entry point the plugin calls when it loads the library.
rusteal_runtime::on_load!(function)Runs a function every time the library loads, hot reloads included.
log::info!, log::warn!, log::error!Write to the Output Log, through the log crate (see Logging).