Skip to content

Functions

How do I add a function Blueprints can call?

Decorate a method with @ue.ufunction. It becomes a new UFunction, callable from Blueprints, C++ and reflection.

@ue.uclass
class Turret(ue.Actor):
    @ue.ufunction
    def fire(self, power: float) -> bool:
        return power > 0.0

    @ue.ufunction(pure=True, category="Combat")
    def is_ready(self) -> bool:
        return True

    @ue.ufunction
    @staticmethod
    def default_power() -> float:
        return 10.0

The type annotations give the Unreal signature. Methods without @ue.ufunction stay Python-only helpers.

Options

Option Meaning
pure A pure (no execution pin) Blueprint node.
server, client, multicast Make it a remote call. Choose one. See Remote calls.
reliable With a remote kind: never dropped.
category, meta Editor metadata.

Notes

  • Class methods cannot be ufunctions; use @staticmethod.
  • @ue.ufunction is for new functions. Overrides of existing Unreal events do not need it (Events).
  • Calling a ufunction from Python goes through Unreal, so it behaves as a Blueprint or C++ call would.