RegisterCallbackOnce
Adds an event handler to the instance. The event handler is automatically unregistered after it has been invoked exactly once.
阅读时间1 分钟最后更新于 1 个月前
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
RegisterCallbackOnce<T>(EventCallback<T>, TrickleDown)
Adds an event handler to the instance. 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. If the handler is null, this method throws an exception.
By default, this callback is called during the BubbleUp phase. Pass to call this callback during the TrickleDown phase.
TrickleDown.TrickleDownRemarks
If the event handler is already registered for the same phase (either TrickleDown or BubbleUp) and hasn't been invoked yet, this method has no effect.
Additional Resources: PropagationPhase, CallbackEventHandler.RegisterCallback
RegisterCallbackOnce<T, U>(EventCallback<T, T>, T, TrickleDown)
Adds an event handler to the instance. 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. If the handler is null, this method throws an exception.
By default, this callback is called during the BubbleUp phase. Pass TrickleDown.TrickleDown to call this callback during the TrickleDown phase.
Remarks
If the event handler is already registered for the same phase (either TrickleDown or BubbleUp) and hasn't been invoked yet, this method has no effect.
Additional Resources: PropagationPhase, CallbackEventHandler.RegisterCallback