Interface IXRFocusInteractable
An interface that represents an Interactable component which an Interactor component can persistently select.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
public interface IXRFocusInteractable : IXRInteractable
Properties
canFocus
Indicates whether this Interactable can be focused.
Declaration
bool canFocus { get; }
Property Value
Type | Description |
---|---|
Boolean |
firstFocusEntered
The event that is called only when the first Interaction Group gains focus on this Interactable as the sole focusing Interactor. Subsequent Interactors that gain focus will not cause this event to be invoked as long as any others are still focusing.
Declaration
FocusEnterEvent firstFocusEntered { get; }
Property Value
Type | Description |
---|---|
FocusEnterEvent |
Remarks
The FocusEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
firstInteractionGroupFocusing
(Read Only) The first interaction group that is focused on this interactable since not being focused. The group may not currently be focusing this interactable, which would be the case when it released while multiple groups were focusing this interactable.
Declaration
IXRInteractionGroup firstInteractionGroupFocusing { get; }
Property Value
Type | Description |
---|---|
IXRInteractionGroup |
focusEntered
The event that is called when an Interaction group gains focus on this Interactable.
Declaration
FocusEnterEvent focusEntered { get; }
Property Value
Type | Description |
---|---|
FocusEnterEvent |
Remarks
The FocusEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
focusExited
The event that is called when an Interaction group loses focus on this Interactable.
Declaration
FocusExitEvent focusExited { get; }
Property Value
Type | Description |
---|---|
FocusExitEvent |
Remarks
The FocusExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
focusMode
Indicates the focus policy of an Interactable.
Declaration
InteractableFocusMode focusMode { get; }
Property Value
Type | Description |
---|---|
InteractableFocusMode |
See Also
interactionGroupsFocusing
(Read Only) The list of Interaction groups currently focusing on this Interactable (may by empty).
Declaration
List<IXRInteractionGroup> interactionGroupsFocusing { get; }
Property Value
Type | Description |
---|---|
List<IXRInteractionGroup> |
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
isFocused
(Read Only) Indicates whether this interactable is currently being focused by any interaction group.
Declaration
bool isFocused { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
In other words, returns whether interactionGroupsFocusing contains any interaction groups.
interactionGroupsFocusing.Count > 0
See Also
lastFocusExited
The event that is called only when the last remaining focused Interaction group loses focus on this Interactable.
Declaration
FocusExitEvent lastFocusExited { get; }
Property Value
Type | Description |
---|---|
FocusExitEvent |
Remarks
The FocusExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
Methods
OnFocusEntered(FocusEnterEventArgs)
The XRInteractionManager calls this method when the Interaction group first gains focus of an Interactable in a second pass.
Declaration
void OnFocusEntered(FocusEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusEnterEventArgs | args | Event data containing the Interaction group that is initiating the focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnFocusEntering(FocusEnterEventArgs)
The XRInteractionManager calls this method right before the Interaction group first gains focus of an Interactable in a first pass.
Declaration
void OnFocusEntering(FocusEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusEnterEventArgs | args | Event data containing the Interaction group that is initiating the focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnFocusExited(FocusExitEventArgs)
The XRInteractionManager calls this method when the Interaction group loses focus of an Interactable in a second pass.
Declaration
void OnFocusExited(FocusExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusExitEventArgs | args | Event data containing the Interaction group that is losing focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnFocusExiting(FocusExitEventArgs)
The XRInteractionManager calls this method right before the Interaction group loses focus of an Interactable in a first pass.
Declaration
void OnFocusExiting(FocusExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusExitEventArgs | args | Event data containing the Interaction group that is losing focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.