Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

Create<T>(EventCallback<T>, CallbackOptions)

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
.
public static EventCallbackDefinition Create<TEvent>(EventCallback<TEvent> userCallback, CallbackOptions callbackOptions = CallbackOptions.Default) where TEvent : EventBase<TEvent>, new()

Parameters

userCallback

The delegate called when this callback is triggered.

callbackOptions

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

EventCallbackDefinitionThe created callback instance

Create<T, U>(EventCallback<T, T>, CallbackOptions)

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
. The delegate will always be called with its second argument set to the element on which it's registered.
public 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.

callbackOptions

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
userCallback
delegate when registered on an element that is part of the propagation chain of any event of type
TEvent
. The delegate will be called with its second argument set to whichever value the
arg
parameter holds for the element on which it's registered.
public 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.

callbackOptions

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

EventCallbackDefinitionThe created callback instance