# 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.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.6/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## 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`.

```csharp
public static EventCallbackDefinition Create<TEvent>(EventCallback<TEvent> userCallback, CallbackOptions callbackOptions = CallbackOptions.Default) where TEvent : EventBase<TEvent>, new()
```

### Parameters

**** (\[EventCallback\<T>]\(/engine/6000.6/script-reference/unityengine/uielements/eventcallback)): The delegate called when this callback is triggered.**** (\[CallbackOptions]\(/engine/6000.6/script-reference/unityengine/uielements/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](/engine/6000.6/script-reference/unityengine/uielements/eventcallbackdefinition.md) | The 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.

```csharp
public static EventCallbackDefinition<TElement> Create<TEvent, TElement>(EventCallback<TEvent, TElement> userCallback, CallbackOptions callbackOptions = CallbackOptions.Default) where TEvent : EventBase<TEvent>, new() where TElement : VisualElement
```

### Parameters

**** (\[EventCallback\<T, T>]\(/engine/6000.6/script-reference/unityengine/uielements/eventcallback)): The delegate called when this callback is triggered.**** (\[CallbackOptions]\(/engine/6000.6/script-reference/unityengine/uielements/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>](/engine/6000.6/script-reference/unityengine/uielements/eventcallbackdefinition.md) | 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.

```csharp
public static EventCallbackDefinition Create<TEvent, TArg>(EventCallback<TEvent, TArg> userCallback, EventArg<TArg> arg, CallbackOptions callbackOptions = CallbackOptions.Default) where TEvent : EventBase<TEvent>, new()
```

### Parameters

**** (\[EventCallback\<T, T>]\(/engine/6000.6/script-reference/unityengine/uielements/eventcallback)): The delegate called when this callback is triggered.**** (\[EventArg\<T>]\(/engine/6000.6/script-reference/unityengine/uielements/eventarg)): The identifier used to send specific argument values to the delegate for any element on which this callback is registered.**** (\[CallbackOptions]\(/engine/6000.6/script-reference/unityengine/uielements/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](/engine/6000.6/script-reference/unityengine/uielements/eventcallbackdefinition.md) | The created callback instance |
