Skip to main content

Event

A wrapper class to UnityEvent. You can use this type to use Unity Events in SerializedField function to serialize events.

Members

Methods

NameDescription
Event.AddListener(Funcion)Adds a non-permanent listener to event handler. The added listener will be invoked with the rest of the listeners when the invoke function is called. The listener function cannot have any parameters.
Event.Invoke()Invoke this event. This calls all the attached listeners, permanent and otherwise.
Event.RemoveAllListeners()Remove all attached non-permanent events from the event handler.

Example

The listeners that are attached trough the inspector are categorized as permanent listeners. These listeners cannot be removed. You can, however, attach other listeners as well.

local myEvent = SerializedField("Event Name", Event);

myEvent.Invoke();