Modifier

PressableButton Class

Definition

A button that can be pushed via direct touch. You can use PhysicalPressEventRouter to route these events to Interactable.

public ref class PressableButton : UnityEngine::MonoBehaviour, Microsoft::MixedReality::Toolkit::Input::IMixedRealityTouchHandler, UnityEngine::EventSystems::IEventSystemHandler
[UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/PressableButton")]
[UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/ux-building-blocks/button")]
public class PressableButton : UnityEngine.MonoBehaviour, Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler, UnityEngine.EventSystems.IEventSystemHandler
[<UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/PressableButton")>]
[<UnityEngine.HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/ux-building-blocks/button")>]
type PressableButton = class
    inherit MonoBehaviour
    interface IMixedRealityTouchHandler
    interface IEventSystemHandler
Public Class PressableButton
Inherits MonoBehaviour
Implements IEventSystemHandler, IMixedRealityTouchHandler
Inheritance
UnityEngine.MonoBehaviour
PressableButton
Derived
Attributes
UnityEngine.AddComponentMenuAttribute UnityEngine.HelpURLAttribute
Implements
IMixedRealityTouchHandler UnityEngine.EventSystems.IEventSystemHandler

Constructors

PressableButton()

Fields

ButtonPressed
ButtonReleased
movingButtonVisuals

The object that is being pushed.

startPushDistance
TouchBegin
TouchEnd

Properties

CurrentPushDistance

Current push distance relative to the start push plane.

DistanceSpaceMode

Describes in which coordinate space the plane distances are stored and calculated

EnforceFrontPush

Ensures that the button can only be pushed from the front. Touching the button from the back or side is prevented.

IsPressing

Represents the state of whether the button is currently being pressed.

IsTouching

Represents the state of whether or not a finger is currently touching this button.

LocalToWorldScale

Transform for local to world space in the world direction of a press Multiply local scale positions by this value to convert to world space

MaxPushDistance

Maximum push distance. Distance is relative to the pivot of either the moving visuals if there's any or the button itself.

PressDistance

Distance the button must be pushed until it is considered pressed. Distance is relative to the pivot of either the moving visuals if there's any or the button itself.

ReleaseDistanceDelta

Withdraw amount needed to transition from Pressed to Released.

ReleaseOnTouchEnd

Button will send the release event on touch end after successful press even if release plane hasn't been passed.

StartPushDistance

The offset at which pushing starts. Offset is relative to the pivot of either the moving visuals if there's any or the button itself.

Methods

GetDistanceAlongPushDirection(Vector3)

Returns the local distance along the push direction for the passed in world position

GetLocalPositionAlongPushDirection(Single)

Returns local position along the push direction for the given local distance

GetWorldPositionAlongPushDirection(Single)

Returns world space position along the push direction for the given local distance

Start()
UpdateMovingVisualsPosition()

Explicit Interface Implementations

IMixedRealityTouchHandler.OnTouchCompleted(HandTrackingInputEventData)
IMixedRealityTouchHandler.OnTouchStarted(HandTrackingInputEventData)
IMixedRealityTouchHandler.OnTouchUpdated(HandTrackingInputEventData)

Applies to