Skip to main content

uclass_impl

Attribute Macro uclass_impl 

Source
#[uclass_impl]
Expand description

Attribute macro for an impl block on a #[uclass] struct. Methods marked #[ufunction(...)] become UE-callable functions.

§Example

ⓘ
#[uclass_impl]
impl MyEnemy {
    #[ufunction(BlueprintCallable)]
    fn take_damage(&mut self, amount: f32) -> bool {
        let h = self.health() - amount;
        self.set_health(h.max(0.0));
        h <= 0.0
    }

    fn helper(&self) -> f32 { self.health() * 2.0 }  // plain Rust method
}