Inspector Configuration

An UltEvent has two sets of listeners:

  • Persistent listeners are configured in the Unity Editor using the Inspector.
  • Dynamic listeners are added using code at runtime.

You can add a persistent listener using the [+] button or by dragging and dropping an object from the Hierarchy window or Project window onto the event.

If an event has multiple calls, you can drag them around to change their execution order. Execution starts at the top and travels down the list.

Configuring a Function Call

# Details
1 UltEvents are collapsed by default to save screen space and can be expanded using the foldout arrow.
2 The name of the event field is shown in the header along with its parameter types.
3 The number of persistent listeners is shown in the top right next to the + button to add another one.
4 The - button next to a listener removes it.
5

Each persistent listener has a target object (for instance methods) or a type reference (for static methods).

When a new call is added, it will be given the component containing the event as its default target.

To change to a type reference you can select Static Method from the method selection menu (#6) or simply click on the field and press the Delete key. To change back to a target object, you can simply drag and drop it onto the field or select it using the Object Picker just to the right of the type field.
6

Each persistent listener also has a target method which you select from a dropdown menu.

The sub-menus near the top of the method selection menu allow you to select methods from any other components on the same GameObject. Doing so will automatically change the target object accordingly.

If a method name you selected previously no longer exists (such as if you select a method then rename or remove it from your code), it will be highlighted in red. It will also show a [?] button which will assign another existing method with the most similar name according to a metric known as Levenshtein Distance.
7 Once you select a method, it will show the names of each of its parameters alongside fields where you can specify the values you want the event to pass into that method.
8 If the selected method is a property getter or setter, it will show a button to toggle between them.
9

If a parameter matches one of the event's parameters or the return type of an earlier listener, it will show a [∞] button which will link the parameter to use that value instead of having you enter one in a regular field.

This event has a Collider parameter as shown at #2, but the position parameter of #9 is linked to the return value of the get_position call at #8 (the getter of the Transform.position property) so that the sound will be played at the current location of the Pressure Plate instead of at a fixed position. See Advanced/Event Parameters and Advanced/Linked Return Values for more details.

Context Menus

You can Right Click on an event header to open a context menu:

Function Description
Invoke Event Calls UltEventBase.Invoke to execute the event.
Copy Event Copies the event to the clipboard.
Paste Event (Overwrite) Overwrites the current event with the one that was last copied to the clipboard.
Paste Listener (New)

Adds the persistent listener from the clipboard to the end of the event (see below for copying a listener to the clipboard).

This function can also be used by selecting the listener and pressing Ctrl + Shift + V.
Clear Event Calls UltEventBase.Clear to remove all listeners from the event.
Log Description Logs a description of the event and its listeners in the Console.
Display Options A sub-menu containing various settings to control what is shown and how everything is arranged.

You can also Right Click on a persistent listener to open a context menu:

Function Description
Duplicate Array Element

Adds another identical listener right after the selected one.

This function can also be used by selecting the listener and pressing Ctrl + C to copy it then Ctrl + Shift + V to paste it as a new listener.
Delete Array Element

Removes the selected listener from the event.

This function can also be used by selecting the listener and pressing Delete.
Copy Listener

Copies the selected listener to the clipboard.

This function can also be used by selecting the listener and pressing Ctrl + C.
Paste Listener (Overwrite)

Overwrites the current listener with the one that was last copied to the clipboard.

This function can also be used by selecting the listener and pressing Ctrl + V.
Display Options A sub-menu containing various settings to control what is shown and how everything is arranged.

When you have a persistent listener selected, you can also use the + key to add a new listener right after it.