Skip to content

Events

How do I react to begin play, tick and overlaps?

Define a method with the event's snake_case name. No decorator is needed.

@ue.uclass
class Spinner(ue.ActorComponent):
    degrees_per_second: float = ue.uproperty(90.0)

    def begin_play(self) -> None: ...

    def tick(self, delta_seconds: float) -> None:
        owner = self.get_owner()
        if owner is not None:
            owner.add_actor_local_rotation(
                ue.Rotator(0.0, self.degrees_per_second * delta_seconds, 0.0), False, True
            )

Common events

Python method Unreal event
begin_play ReceiveBeginPlay
end_play ReceiveEndPlay
tick(delta_seconds) ReceiveTick
destroyed ReceiveDestroyed
actor_begin_overlap(other_actor) ReceiveActorBeginOverlap
actor_end_overlap(other_actor) ReceiveActorEndOverlap
hit ReceiveHit

Ticking is enabled for classes that define tick.

Lifecycle: post_init

post_init(self) runs after an instance is created. Use it to initialise Python-only state. Subsystems (WorldSubsystem, GameInstanceSubsystem, LocalPlayerSubsystem, EngineSubsystem, and EditorSubsystem in the editor) also support post_deinit(self), called when Unreal deinitializes the subsystem. See Subsystems for an example and when to use each lifetime.

Other events

An override of any reflected event of the parent class works the same way: name the method as the Python form of the Unreal function. Replication callbacks named by rep_notify are recognized without a decorator.