Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RegisterCallbackOnce

Adds an event handler to the instance. If the event handler has already been registered for the same phase (either TrickleDown or BubbleUp) then this method has no effect. The event handler is automatically unregistered after it has been invoked exactly once.
Read time 1 minuteLast updated 12 days ago

Definition

RegisterCallbackOnce<T>(EventCallback<T>, TrickleDown)

Adds an event handler to the instance. If the event handler has already been registered for the same phase (either TrickleDown or BubbleUp) then this method has no effect. The event handler is automatically unregistered after it has been invoked exactly once.
public void RegisterCallbackOnce<TEventType>(EventCallback<TEventType> callback, TrickleDown useTrickleDown = TrickleDown.NoTrickleDown) where TEventType : EventBase<TEventType>, new()

Parameters

The event handler to add.

useTrickleDown

By default, this callback is called during the BubbleUp phase. Pass
TrickleDown.TrickleDown
to call this callback during the TrickleDown phase.

RegisterCallbackOnce<T, U>(EventCallback<T, T>, T, TrickleDown)

Adds an event handler to the instance. If the event handler has already been registered for the same phase (either TrickleDown or BubbleUp) then this method has no effect. The event handler is automatically unregistered after it has been invoked exactly once.
public void RegisterCallbackOnce<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType> callback, TUserArgsType userArgs, TrickleDown useTrickleDown = TrickleDown.NoTrickleDown) where TEventType : EventBase<TEventType>, new()

Parameters

The event handler to add.

userArgs

T
Data to pass to the callback.

useTrickleDown

By default, this callback is called during the BubbleUp phase. Pass TrickleDown.TrickleDown to call this callback during the TrickleDown phase.