Create
Creates a callback instance that will call the given userCallback delegate when registered on an element that is part of the propagation chain of any event of type TEvent.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
Create<T>(EventCallback<T>, CallbackOptions)
Creates a callback instance that will call the given delegate when registered on an element that is part of the propagation chain of any event of type .
userCallbackTEventpublic static EventCallbackDefinition Create<TEvent>(EventCallback<TEvent> userCallback, CallbackOptions callbackOptions = CallbackOptions.Default) where TEvent : EventBase<TEvent>, new()
Parameters
The delegate called when this callback is triggered.
Extra properties to set for the callback. Use the CallbackOptions.TrickleDown flag to specify the propagation phase. Use CallbackOptions.Once to automatically unregister this callback when invoked.
Returns
Type | Description |
|---|---|
| EventCallbackDefinition | The created callback instance |
Create<T, U>(EventCallback<T, T>, CallbackOptions)
Creates a callback instance that will call the given delegate when registered on an element that is part of the propagation chain of any event of type . The delegate will always be called with its second argument set to the element on which it's registered.
userCallbackTEventpublic static EventCallbackDefinition<TElement> Create<TEvent, TElement>(EventCallback<TEvent, TElement> userCallback, CallbackOptions callbackOptions = CallbackOptions.Default) where TEvent : EventBase<TEvent>, new() where TElement : VisualElement
Parameters
The delegate called when this callback is triggered.
Extra properties to set for the callback. Use the CallbackOptions.TrickleDown flag to specify the propagation phase. Use CallbackOptions.Once to automatically unregister this callback when invoked.
Returns
Type | Description |
|---|---|
| EventCallbackDefinition<T> | The created callback instance |
Create<T, U>(EventCallback<T, T>, EventArg<T>, CallbackOptions)
Creates a callback instance that will call the given delegate when registered on an element that is part of the propagation chain of any event of type . The delegate will be called with its second argument set to whichever value the parameter holds for the element on which it's registered.
userCallbackTEventargpublic static EventCallbackDefinition Create<TEvent, TArg>(EventCallback<TEvent, TArg> userCallback, EventArg<TArg> arg, CallbackOptions callbackOptions = CallbackOptions.Default) where TEvent : EventBase<TEvent>, new()
Parameters
The delegate called when this callback is triggered.
The identifier used to send specific argument values to the delegate for any element on which this callback is registered.
Extra properties to set for the callback. Use the CallbackOptions.TrickleDown flag to specify the propagation phase. Use CallbackOptions.Once to automatically unregister this callback when invoked.
Returns
Type | Description |
|---|---|
| EventCallbackDefinition | The created callback instance |