Class XRBaseInteractor
Abstract base class from which all interactor behaviours derive. This class hooks into the interaction system (via XRInteractionManager) and provides base virtual methods for handling hover and selection
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[SelectionBase]
[DisallowMultipleComponent]
[DefaultExecutionOrder(-99)]
public abstract class XRBaseInteractor : MonoBehaviour, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRGroupMember, IXRInteractionStrengthInteractor, IXRInteractor
Properties
allowHover
Defines whether this interactor allows hover events.
Declaration
public bool allowHover { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
A hover exit event will still occur if this value is disabled while hovering.
allowSelect
Defines whether this interactor allows select events.
Declaration
public bool allowSelect { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
A select exit event will still occur if this value is disabled while selecting.
attachTransform
The Transform that is used as the attach point for Interactables.
Declaration
public Transform attachTransform { get; set; }
Property Value
Type | Description |
---|---|
Transform |
Remarks
Automatically instantiated and set in Awake() if null. Setting this will not automatically destroy the previous object.
containingGroup
The Interaction Group that contains this member.
Declaration
public IXRInteractionGroup containingGroup { get; }
Property Value
Type | Description |
---|---|
IXRInteractionGroup |
disableVisualsWhenBlockedInGroup
Whether to disable Interactor visuals (such as XRInteractorLineVisual) when this Interactor is part of an IXRInteractionGroup and is incapable of interacting due to active interaction by another Interactor in the Group.
Declaration
public bool disableVisualsWhenBlockedInGroup { get; set; }
Property Value
Type | Description |
---|---|
bool |
firstInteractableSelected
(Read Only) The first Interactable selected since not having any selection. This Interactor may not currently be selecting the Interactable, which would be the case when it was released while multiple Interactables were selected.
Declaration
public IXRSelectInteractable firstInteractableSelected { get; }
Property Value
Type | Description |
---|---|
IXRSelectInteractable |
See Also
hasHover
(Read Only) Indicates whether this Interactor is currently hovering an Interactable.
Declaration
public bool hasHover { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
In other words, returns whether interactablesHovered contains any Interactables.
interactablesHovered.Count > 0
See Also
hasSelection
(Read Only) Indicates whether this Interactor is currently selecting an Interactable.
Declaration
public bool hasSelection { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
In other words, returns whether interactablesSelected contains any Interactables.
interactablesSelected.Count > 0
See Also
hoverEntered
The event that is called when this Interactor begins hovering over an Interactable.
Declaration
public HoverEnterEvent hoverEntered { get; set; }
Property Value
Type | Description |
---|---|
HoverEnterEvent |
Remarks
The HoverEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
hoverExited
The event that is called when this Interactor ends hovering over an Interactable.
Declaration
public HoverExitEvent hoverExited { get; set; }
Property Value
Type | Description |
---|---|
HoverExitEvent |
Remarks
The HoverExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
hoverFilters
The list of hover filters in this object. Used as additional hover validations for this Interactor.
Declaration
public IXRFilterList<IXRHoverFilter> hoverFilters { get; }
Property Value
Type | Description |
---|---|
IXRFilterList<IXRHoverFilter> |
Remarks
While processing hover filters, all changes to this list don't have an immediate effect. These changes are buffered and applied when the processing is finished. Calling MoveTo(T, int) in this list will throw an exception when this list is being processed.
See Also
interactablesHovered
(Read Only) The list of Interactables that are currently being hovered over (may by empty).
Declaration
public List<IXRHoverInteractable> interactablesHovered { get; }
Property Value
Type | Description |
---|---|
List<IXRHoverInteractable> |
Remarks
You should treat this as a read only view of the list and should not modify it. It is exposed as a List<T> rather than an IReadOnlyList<T> to avoid GC Allocations when enumerating the list.
See Also
interactablesSelected
(Read Only) The list of Interactables that are currently being selected (may by empty).
Declaration
public List<IXRSelectInteractable> interactablesSelected { get; }
Property Value
Type | Description |
---|---|
List<IXRSelectInteractable> |
Remarks
This should be treated as a read only view of the list and should not be modified by external callers. It is exposed as a List<T> rather than an IReadOnlyList<T> to avoid GC Allocations when enumerating the list.
See Also
interactionLayers
Allows interaction with Interactables whose Interaction Layer Mask overlaps with any Layer in this Interaction Layer Mask.
Declaration
public InteractionLayerMask interactionLayers { get; set; }
Property Value
Type | Description |
---|---|
InteractionLayerMask |
See Also
interactionManager
The XRInteractionManager that this Interactor will communicate with (will find one if null).
Declaration
public XRInteractionManager interactionManager { get; set; }
Property Value
Type | Description |
---|---|
XRInteractionManager |
isHoverActive
(Read Only) Indicates whether this Interactor is in a state where it could hover.
Declaration
public virtual bool isHoverActive { get; }
Property Value
Type | Description |
---|---|
bool |
isPerformingManualInteraction
Defines whether this interactor is performing a manual interaction or not.
Declaration
public bool isPerformingManualInteraction { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
isSelectActive
(Read Only) Indicates whether this Interactor is in a state where it could select.
Declaration
public virtual bool isSelectActive { get; }
Property Value
Type | Description |
---|---|
bool |
keepSelectedTargetValid
Whether to keep selecting an Interactable after initially selecting it even when it is no longer a valid target.
Declaration
public bool keepSelectedTargetValid { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Return true to make the XRInteractionManager retain the selection even if the
Interactable is not contained within the list of valid targets. Return false to make
the Interaction Manager clear the selection if it isn't within the list of valid targets.
A common use for disabling this is for Ray Interactors used for teleportation to make the teleportation Interactable
no longer selected when not currently pointing at it.
largestInteractionStrength
The largest interaction strength value of all interactables this interactor is hovering or selecting.
Declaration
public IReadOnlyBindableVariable<float> largestInteractionStrength { get; }
Property Value
Type | Description |
---|---|
IReadOnlyBindableVariable<float> |
selectEntered
The event that is called when this Interactor begins selecting an Interactable.
Declaration
public SelectEnterEvent selectEntered { get; set; }
Property Value
Type | Description |
---|---|
SelectEnterEvent |
Remarks
The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
selectExited
The event that is called when this Interactor ends selecting an Interactable.
Declaration
public SelectExitEvent selectExited { get; set; }
Property Value
Type | Description |
---|---|
SelectExitEvent |
Remarks
The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
selectFilters
The list of select filters in this object. Used as additional select validations for this Interactor.
Declaration
public IXRFilterList<IXRSelectFilter> selectFilters { get; }
Property Value
Type | Description |
---|---|
IXRFilterList<IXRSelectFilter> |
Remarks
While processing select filters, all changes to this list don't have an immediate effect. Theses changes are buffered and applied when the processing is finished. Calling MoveTo(T, int) in this list will throw an exception when this list is being processed.
See Also
selectedInteractableMovementTypeOverride
(Read Only) Overriding movement type of the selected Interactable's movement. By default, this does not override the movement type.
Declaration
public virtual XRBaseInteractable.MovementType? selectedInteractableMovementTypeOverride { get; }
Property Value
Type | Description |
---|---|
XRBaseInteractable.MovementType? |
Remarks
You can use this to change the effective movement type of an Interactable for different Interactors. An example would be having an Interactable use VelocityTracking so it does not move through geometry with a Collider when interacting with it using a Ray or Direct Interactor, but have a Socket Interactor override the movement type to be Instantaneous for reduced movement latency.
See Also
startingHoverFilters
The hover filters that this object uses to automatically populate the hoverFilters List at startup (optional, may be empty). All objects in this list should implement the IXRHoverFilter interface.
Declaration
public List<Object> startingHoverFilters { get; set; }
Property Value
Type | Description |
---|---|
List<Object> |
Remarks
To access and modify the hover filters used after startup, the hoverFilters List should be used instead.
See Also
startingSelectFilters
The select filters that this object uses to automatically populate the selectFilters List at startup (optional, may be empty). All objects in this list should implement the IXRSelectFilter interface.
Declaration
public List<Object> startingSelectFilters { get; set; }
Property Value
Type | Description |
---|---|
List<Object> |
Remarks
To access and modify the select filters used after startup, the selectFilters List should be used instead.
See Also
startingSelectedInteractable
The Interactable that this Interactor automatically selects at startup (optional, may be null).
Declaration
public XRBaseInteractable startingSelectedInteractable { get; set; }
Property Value
Type | Description |
---|---|
XRBaseInteractable |
startingTargetFilter
The Target Filter that this Interactor automatically links at startup (optional, may be null).
Declaration
public XRBaseTargetFilter startingTargetFilter { get; set; }
Property Value
Type | Description |
---|---|
XRBaseTargetFilter |
Remarks
To modify the Target Filter after startup, the targetFilter property should be used instead.
See Also
targetFilter
The Target Filter that this Interactor is linked to.
Declaration
public IXRTargetFilter targetFilter { get; set; }
Property Value
Type | Description |
---|---|
IXRTargetFilter |
See Also
targetPriorityMode
Specifies how many Interactables should be monitored in the targetsForSelection property.
Declaration
public virtual TargetPriorityMode targetPriorityMode { get; set; }
Property Value
Type | Description |
---|---|
TargetPriorityMode |
targetsForSelection
The Interactables with priority for selection in the current frame, some Interactables might be already selected. This list is sorted by priority (with highest priority first). How many Interactables appear in this list is configured by the targetPriorityMode property.
Declaration
public virtual List<IXRSelectInteractable> targetsForSelection { get; set; }
Property Value
Type | Description |
---|---|
List<IXRSelectInteractable> |
Remarks
Unity automatically clears and updates this list every frame if targetPriorityMode has a value different from None, in this case a valid list must be returned.
Methods
Awake()
See MonoBehaviour.
Declaration
protected virtual void Awake()
CanHover(IXRHoverInteractable)
Determines if the Interactable is valid for hover this frame.
Declaration
public virtual bool CanHover(IXRHoverInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRHoverInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if the Interactable can be hovered over this frame. |
See Also
CanSelect(IXRSelectInteractable)
Determines if the Interactable is valid for selection this frame.
Declaration
public virtual bool CanSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if the Interactable can be selected this frame. |
See Also
CaptureAttachPose(IXRSelectInteractable)
Capture the current Attach Transform pose. This method is automatically called by Unity to capture the pose during the moment of selection.
Declaration
protected void CaptureAttachPose(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Remarks
Unity automatically calls this method during OnSelectEntering(SelectEnterEventArgs) and should not typically need to be called by a user.
See Also
CreateAttachTransform()
Create a new child GameObject to use as the attach transform if one is not set.
Declaration
protected void CreateAttachTransform()
See Also
EndManualInteraction()
Ends the manually initiated selection of an Interactable.
Declaration
public virtual void EndManualInteraction()
See Also
GetAttachPoseOnSelect(IXRSelectInteractable)
Gets the world position and rotation of the Attach Transform captured during the moment of selection.
Declaration
public Pose GetAttachPoseOnSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Returns
Type | Description |
---|---|
Pose | Returns the world pose of the attachment point during the moment of selection, and otherwise the identity Pose if it was not selected during the current selection stack. |
See Also
GetAttachTransform(IXRInteractable)
Gets the Transform that is used as the attachment point for a given Interactable.
Declaration
public virtual Transform GetAttachTransform(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Returns
Type | Description |
---|---|
Transform | Returns the attachment point Transform. |
Remarks
This should typically return the Transform of a child GameObject or the transform itself.
See Also
GetInteractionStrength(IXRInteractable)
Gets the interaction strength between the given interactable and this interactor.
Declaration
public float GetInteractionStrength(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | The specific interactable to get the interaction strength between. |
Returns
Type | Description |
---|---|
float | Returns a value |
GetLocalAttachPoseOnSelect(IXRSelectInteractable)
Gets the local position and rotation of the Attach Transform captured during the moment of selection.
Declaration
public Pose GetLocalAttachPoseOnSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Returns
Type | Description |
---|---|
Pose | Returns the local pose of the attachment point during the moment of selection, and otherwise the identity Pose if it was not selected during the current selection stack. |
See Also
GetValidTargets(List<IXRInteractable>)
Retrieve the list of Interactables that this Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first).
Declaration
public virtual void GetValidTargets(List<IXRInteractable> targets)
Parameters
Type | Name | Description |
---|---|---|
List<IXRInteractable> | targets | The results list to populate with Interactables that are valid for selection or hover. |
Remarks
When implementing this method, Unity expects you to clear targets
before adding to it.
IsHovering(IXRHoverInteractable)
Determines whether this Interactor is currently hovering the Interactable.
Declaration
public bool IsHovering(IXRHoverInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRHoverInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactor is currently hovering the Interactable.
Otherwise, returns |
Remarks
In other words, returns whether interactablesHovered contains interactable
.
See Also
IsHovering(IXRInteractable)
Determines whether this Interactor is currently hovering the Interactable.
Declaration
protected bool IsHovering(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactor is currently hovering the Interactable.
Otherwise, returns |
Remarks
In other words, returns whether interactablesHovered contains interactable
.
See Also
IsSelecting(IXRInteractable)
Determines whether this Interactor is currently selecting the Interactable.
Declaration
protected bool IsSelecting(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactor is currently selecting the Interactable.
Otherwise, returns |
Remarks
In other words, returns whether interactablesSelected contains interactable
.
See Also
IsSelecting(IXRSelectInteractable)
Determines whether this Interactor is currently selecting the Interactable.
Declaration
public bool IsSelecting(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactor is currently selecting the Interactable.
Otherwise, returns |
Remarks
In other words, returns whether interactablesSelected contains interactable
.
See Also
OnDestroy()
See MonoBehaviour.
Declaration
protected virtual void OnDestroy()
OnDisable()
See MonoBehaviour.
Declaration
protected virtual void OnDisable()
OnEnable()
See MonoBehaviour.
Declaration
protected virtual void OnEnable()
OnHoverEntered(HoverEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass.
Declaration
protected virtual void OnHoverEntered(HoverEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverEnterEventArgs | args | Event data containing the Interactable that is being hovered over. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnHoverEntering(HoverEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.
Declaration
protected virtual void OnHoverEntering(HoverEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverEnterEventArgs | args | Event data containing the Interactable that is being hovered over. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnHoverExited(HoverExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.
Declaration
protected virtual void OnHoverExited(HoverExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverExitEventArgs | args | Event data containing the Interactable that is no longer hovered over. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnHoverExiting(HoverExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.
Declaration
protected virtual void OnHoverExiting(HoverExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverExitEventArgs | args | Event data containing the Interactable that is no longer hovered over. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnRegistered(InteractorRegisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is registered with it.
Declaration
protected virtual void OnRegistered(InteractorRegisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractorRegisteredEventArgs | args | Event data containing the Interaction Manager that registered this Interactor. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntered(SelectEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
protected virtual void OnSelectEntered(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactable that is being selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntering(SelectEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.
Declaration
protected virtual void OnSelectEntering(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactable that is being selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectExited(SelectExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
protected virtual void OnSelectExited(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactable that is no longer selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectExiting(SelectExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.
Declaration
protected virtual void OnSelectExiting(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactable that is no longer selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnUnregistered(InteractorUnregisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is unregistered from it.
Declaration
protected virtual void OnUnregistered(InteractorUnregisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractorUnregisteredEventArgs | args | Event data containing the Interaction Manager that unregistered this Interactor. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
PreprocessInteractor(UpdatePhase)
The XRInteractionManager or containing IXRInteractionGroup calls this method to update the Interactor before interaction events occur. Interactors should use this method to do tasks like determine their valid targets.
Declaration
public virtual void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
ProcessHoverFilters(IXRHoverInteractable)
Returns the processing value of the filters in hoverFilters for this Interactor and the given Interactable.
Declaration
protected bool ProcessHoverFilters(IXRHoverInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRHoverInteractable | interactable | The Interactable to be validated by the hover filters. |
Returns
Type | Description |
---|---|
bool | Returns true if all processed filters also return true, or if hoverFilters is empty. Otherwise, returns false. |
ProcessInteractionStrength(UpdatePhase)
The XRInteractionManager calls this method to signal to update the interaction strength.
Declaration
protected virtual void ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase during which this method is called. |
See Also
ProcessInteractor(UpdatePhase)
The XRInteractionManager or containing IXRInteractionGroup calls this method to update the Interactor after interaction events occur.
Declaration
public virtual void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
ProcessSelectFilters(IXRSelectInteractable)
Returns the processing value of the filters in selectFilters for this Interactor and the given Interactable.
Declaration
protected bool ProcessSelectFilters(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | The Interactor to be validated by the select filters. |
Returns
Type | Description |
---|---|
bool | Returns true if all processed filters also return true, or if selectFilters is empty. Otherwise, returns false. |
Reset()
See MonoBehaviour.
Declaration
[Conditional("UNITY_EDITOR")]
protected virtual void Reset()
Start()
See MonoBehaviour.
Declaration
protected virtual void Start()
StartManualInteraction(IXRSelectInteractable)
Manually initiate selection of an Interactable.
Declaration
public virtual void StartManualInteraction(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable that is being selected. |
See Also
Events
registered
Calls the methods in its invocation list when this Interactor is registered with an Interaction Manager.
Declaration
public event Action<InteractorRegisteredEventArgs> registered
Event Type
Type | Description |
---|---|
Action<InteractorRegisteredEventArgs> |
Remarks
The InteractorRegisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
unregistered
Calls the methods in its invocation list when this Interactor is unregistered from an Interaction Manager.
Declaration
public event Action<InteractorUnregisteredEventArgs> unregistered
Event Type
Type | Description |
---|---|
Action<InteractorUnregisteredEventArgs> |
Remarks
The InteractorUnregisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.