PressableButton Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The core behavior logic for a button that can be pressed, following the StatefulInteractable pattern.
[UnityEngine.AddComponentMenu("MRTK/UX/Pressable Button")]
public class PressableButton : MixedReality.Toolkit.StatefulInteractable
[UnityEngine.AddComponentMenu("MRTK/UX/Pressable Button")]
public class PressableButton : MixedReality.Toolkit.StatefulInteractable, MixedReality.Toolkit.Input.IXRProximityInteractable
[<UnityEngine.AddComponentMenu("MRTK/UX/Pressable Button")>]
type PressableButton = class
inherit StatefulInteractable
[<UnityEngine.AddComponentMenu("MRTK/UX/Pressable Button")>]
type PressableButton = class
inherit StatefulInteractable
interface IXRProximityInteractable
Public Class PressableButton
Inherits StatefulInteractable
Public Class PressableButton
Inherits StatefulInteractable
Implements IXRProximityInteractable
- Inheritance
-
UnityEngine.XR.Interaction.Toolkit.XRBaseInteractablePressableButton
- Attributes
-
UnityEngine.AddComponentMenuAttribute
- Implements
This script does not make any assumptions about the visuals associated with this button. Any visuals script can listen to the GetSelectionProgress() value, or call PushPlaneLocalPosition() to obtain a selection progress value or a local displacement, respectively, to implement a visual layer.
Allow |
Does the interactable allow triggering select via a voice command? If true, voice command can be used to trigger "select" on the interactable (Inherited from StatefulInteractable) |
Deselect |
The threshold of selection progress at which the interactable will be deselected. (Inherited from StatefulInteractable) |
Distance |
Describes in which coordinate space the plane distances are stored and calculated |
End |
Maximum push distance. Distance is relative to the pivot of either the moving visuals if there's any or the button itself. |
Enforce |
Ensures that the button can only be pushed from the front. Touching the button from the back or side is prevented. |
Far |
Time required for far ray dwell (Inherited from StatefulInteractable) |
Gaze |
Time required for gaze dwell (Inherited from StatefulInteractable) |
Hovering |
(Read Only) The list of IGazeInteractor components currently gazing this object. (Inherited from MRTKBaseInteractable) |
Hovering |
(Read Only) The list of IGazePinchInteractor components currently hovering this object. (Inherited from MRTKBaseInteractable) |
Hovering |
(Read Only) The list of IGrabInteractor components currently hovering this object. (Inherited from MRTKBaseInteractable) |
Hovering |
(Read Only) The list of IPokeInteractor components currently hovering this object. (Inherited from MRTKBaseInteractable) |
Hovering |
(Read Only) The list of IRayInteractor components currently hovering this object. (Inherited from MRTKBaseInteractable) |
Is |
Is this object hovered by any interactor other than passive targeting interactors? (Inherited from MRTKBaseInteractable) |
Is |
Is this object hovered by any gaze interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object hovered by a gaze-pinch interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object selected by a gaze-pinch interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object hovered by a grab interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object selected by a grab interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object hovered by a near touch/poke interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object selected by a poke interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object in proximity of an active Interactor? |
Is |
Is this object hovered by a non-gaze ray interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is this object selected by a non-gaze ray interactor? (Inherited from MRTKBaseInteractable) |
Is |
Is the interactable toggled? (Inherited from StatefulInteractable) |
On |
Fired when the interactable is fully clicked (select + deselect) (Inherited from StatefulInteractable) |
On |
Fired when the interactable is disabled (Inherited from StatefulInteractable) |
On |
Fired when the interactable is enabled (Inherited from StatefulInteractable) |
Reject |
Ensures that the button click event only fires if the push did not roll off the edge of the button in the XY plane. Defaults to true. |
Reject |
Ensures that the button click event only fires if the finger exited the button out the back instead of through the front plate. Defaults to false. |
Roll |
/ If RejectXYRollOff is enabled, roll-offs will be rejected within this normalized press amount of the back plane. |
Selecting |
(Read Only) The list of IGazePinchInteractor components currently selecting this object. (Inherited from MRTKBaseInteractable) |
Selecting |
(Read Only) The list of IGrabInteractor components currently selecting this object. (Inherited from MRTKBaseInteractable) |
Select |
Does the interactable require the interactor to hover over it? If true, then the OnClick event will only get fired while this Interactable is being hovered. (Inherited from StatefulInteractable) |
Select |
The threshold of selection progress at which the interactable will be selected. (Inherited from StatefulInteractable) |
Smooth |
Should this button's selectionProgress be smoothed/animated, or absolute? |
Speech |
Speech keyword required for triggering "select" on the interactable (Inherited from StatefulInteractable) |
Start |
The local z-position of the push plane. |
Toggle |
The toggle behavior of the interactable. Set OneWayToggle for radio buttons. (Inherited from StatefulInteractable) |
Trigger |
Should the user be required to fully select and deselect the interactable for Click and Toggle to fire? (Inherited from StatefulInteractable) |
Use |
Should hovering the object with a far ray for a certain amount of time select it? (Inherited from StatefulInteractable) |
Use |
Should gazing at the object for a certain amount of time select it? (Inherited from StatefulInteractable) |
Voice |
Does the voice command require this to have focus? If true, then the voice command will only respond to voice commands while this Interactable has focus. (Inherited from StatefulInteractable) |
Apply |
Invoked on PressableButton, Awake(), and Reset() to apply required settings to this PressableButton instance. |
Awake() |
A Unity event function that is called when an enabled script instance is being loaded. |
Can |
This function determines whether the interactable should fire a click event at a given select event. Subclasses can override this to add additional requirements for full click/toggle activation, such as roll-off prevention. |
Can |
This function determines whether the interactable should fire a click event at a given deselect event. Subclasses can override this to add additional requirements for full click/toggle activation, such as roll-off prevention. |
Disable |
Adds the specified type to the set of interactors which cannot select this interactable (Inherited from MRTKBaseInteractable) |
Enable |
Removes the specified type to the set of interactors which cannot select this interactable (Inherited from MRTKBaseInteractable) |
Force |
Forcibly toggle the interactable. (Inherited from StatefulInteractable) |
Force |
Forcibly toggle the interactable and fire the relevant events. This is a single-arg overload for ForceSetToggled for use with UnityEvents. Consider using ForceSetToggled(bool, bool) instead, especially if you'd like to suppress the resulting toggle events. (Inherited from StatefulInteractable) |
Get |
Returns the local/global distance along the push direction for the passed in world position |
Get |
Returns local position along the push direction for the given local/global distance |
Get |
Get the current selection progress of this StatefulInteractable. |
Is |
(Inherited from MRTKBaseInteractable) |
Is |
Is the given type of interactor permitted to interact with this interactable? (Inherited from MRTKBaseInteractable) |
Is |
UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.IsSelectableBy(UnityEngine.XR.Interaction.Toolkit.IXRSelectInteractor) |
On |
A Unity event function that is called when the script component has been destroyed. (Inherited from StatefulInteractable) |
On |
A Unity event function that is called when the script component has been disabled. |
On |
A Unity event function that is called when the script component has been enabled. (Inherited from StatefulInteractable) |
On |
(Inherited from StatefulInteractable) |
On |
UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.OnHoverEntered(UnityEngine.XR.Interaction.Toolkit.HoverEnterEventArgs) |
On |
(Inherited from MRTKBaseInteractable) |
On |
UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.OnHoverExited(UnityEngine.XR.Interaction.Toolkit.HoverExitEventArgs) |
On |
(Inherited from MRTKBaseInteractable) |
On |
(Inherited from StatefulInteractable) |
On |
Registers the Detector as triggering proximity. |
On |
Unregisters the Detector as triggering proximity. |
On |
(Inherited from MRTKBaseInteractable) |
On |
(Inherited from MRTKBaseInteractable) |
Process |
UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable.ProcessInteractable(UnityEngine.XR.Interaction.Toolkit.XRInteractionUpdateOrder.UpdatePhase) |
Push |
Returns the position of the front press plane of the button, using the overall selectionProgress of the button, which includes all forms of selection enabled on the interactable. |
Reset() |
A Unity event function that is called when the script should reset it's default values |
Try |
Retrieves the 0..1 amount that the button is currently directly compressed by a finger. Returns true if at least one finger is actively pressing the button; false otherwise. |
Proizvod | Verzije |
---|---|
MRTK3 UX Core | 3.0, 3.1, 3.2 |